Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Program to count number of alphabets in a file.
- #include<fstream.h>
- #include<conio.h>
- #include<ctype.h>
- void main()
- {
- clrscr();
- int count=0;
- char a;
- ofstream ofile("file.txt");
- ofile<<"abcde34fghi43jkl34m234nop2343252qrst34uvwxyz";
- ofile.close();
- ifstream ifile("file.txt");
- while(!ifile.eof())
- {
- ifile.get(a);
- if(isalpha(a))
- count++;
- }
- cout<<count;
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment