Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Program to count number of times for the appearance of word "do".
- #include<fstream.h>
- #include<conio.h>
- #include<ctype.h>
- #include<string.h>
- void main()
- {
- clrscr();
- int count=0;
- char a[10];
- ofstream ofile("file.txt");
- ofile<<"do re me fa so la ti do do re me fa so la ti do do re me fa so la ti do";
- ofile.close();
- ifstream ifile("file.txt");
- while(!ifile.eof())
- {
- ifile>>a;
- if(strcmp(a,"do")==0)
- count++;
- }
- cout<<count;
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment