How to write C++ Program To Count Number Of Alphabets In A File in C++ programming ?
C++ Program To Count Number Of Alphabets In A File |
//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();
}
This C++ Program executes To Count Number Of Alphabets In A File in C++ programming.