Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Program to count number of blanks present in a text file.
- //out.txt:-"C++ is a general purpose programming language."
- #include<iostream.h>
- #include<conio.h>
- #include<fstream.h>
- void main()
- {
- clrscr();
- char a;
- int count=0;
- ifstream ifile("out.txt");
- while(!ifile.eof())
- {
- ifile.get(a);
- if(a==32)
- count++;
- }
- cout<<endl<<"Number of blanks in the file out.txt: "<<count;
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment