Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Program to count number of lines not starting with the alphabet 'A' in a text file.
- /*out.txt:-
- The C++ is a the general purpose the programmingthe language.
- An appple a day keeps the doctor away.
- History repeats itself.
- All that glitters is not gold.
- If life deals you lemons, make lemonade.
- */
- #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();
- }
Advertisement
Add Comment
Please, Sign In to add comment