Function in C++ to count and display the number of lines not starting with alphabet 'A' present in a text file "STORY.TXT"
Source Code
void countlines()
{
ifstream fin;
fin.open("STORY.TXT");
char str[80];
int count=0;
while(!fin.eof())
{
fin.getline(str,80);
if(str[0]!='A')
count++;
}
cout<<"Number of lines not starting with A are "<<count;
fin.close();
}