How to write a C++ Program to read content from a text file out.txt, count and display the number of alphabets present in it in C++ Programming.
![]() |
C++ Program to read content from a text file out.txt, count and display the number of alphabets present in it |
Soulution:
//Program to read content from a text file out.txt, count and display the number of alphabets present in it.
#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();
}
This C++ Program to read content from a text file out.txt, count and display the number of alphabets present in it in C++ Programming.
Learn More :
Data File Handling
- C++ Program To Count Number Of Alphabets In A File
- 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
- 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
Program to Display%28%29
Count Number
Text file
Display
- C++ Program to display the sum of this series: 1+1/2+1/3....1/n.
- C++ Program to enter an amount and display no. of Rs.500,100,50,20,10,5,1 notes.
- C++ Program to enter 'n' numbers and display no. of odd, even and numbers entered till user wishes.
- C++ Program to display prime numbers upto n.
- C++ Program to display first n terms of fibonacci series.
- C++ Program to display a number's digits reversed.
- C++ Program to display the sum of a number's digits.
- Program to display the following pattern: 1 12 123 1234 12345
- Program to display the following pattern: * ** *** **** *****
- Program to display the following pattern: ********** ********** **********
- Program to display the following pattern: * *** ***** ******* *********
- Program to display the following pattern: 1 222 33333 4444444 555555555
- Program to display Pyramid in C++
- C++ Program to display factorial of a number.