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.
Learn More :
fstream.h
ctype.h
File
Data File Handling
- C++ File Handling Binary files - class EMPLOYEE
- C++ Program To Write Numbers 1 to 100 in a data file
- C++ Initializes A String Variable And Outputs String To Disk File
- Read Content From a Text File then Count and Display the Number of Alphabets
- C++ Program to count number of blanks present in a text file
- C++ Program to count number of words in a text file
- C++ Program to Counting Words "the" in a Text File
Count Number