How to write a Program to count number of lines not starting with the alphabet 'A' in a text file in C++Programming.
![]() |
Program to count number of lines not starting with the alphabet 'A' in a text file in C++Programming. |
//Program to count number of lines not starting with the alphabet 'A' in a text file.
/*out.txt:-
*/
#include<iostream.h>
#include<conio.h>
#include<fstream.h>
#include<string.h>
void main()
{
clrscr();
char a[80];
int count=0;
ifstream ifile("out.txt");
while(!ifile.eof())
{
ifile.getline(a,80);
if(a[0]!='A')
count++;
}
cout<<endl<<"Number of lines not starting with 'A' in the file out.txt: "<<count;
getch();
}
This C++ Program to count number of lines not starting with the alphabet 'A' in a text file.
Learn More :
fstream.h
iostream.h
string.h
Lines
Count Number
Text file
- Read Content From a Text File then Count and Display the Number of Alphabets
- C++ Program to count number of blanks present in a text file
- C++ Program to count number of words in a text file
- C++ Program to Counting Words "the" in a Text File
- C++ Program to Print lower-case vowels in second.txt from first.txt