Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Program to read content from a text file out.txt, count and display the number of alphabets present in it.
- //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>=65 && a<=90)||(a>=97&&a<=122))
- {
- count++;
- cout<<a;
- }
- }
- cout<<endl<<"Number of aplhabets in the file out.txt: "<<count;
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment