XII-CS--A PROG TO COUNT ALPHABETS , CONSONANTS AND VOWELS IN A GIVEN TEXT FILE
#include<conio.h>
#include<stdio.h>
#include<fstream.h>
#include<iostream.h>
#include<string.h>
int main()
{
//clrscr();
cout<<"\n..... A PROG TO COUNT ALPHABETS , CONSONANTS AND VOWELS IN A GIVEN TEXT FILE ....\n";
char c;
int alpha=0,conso=0,vow=0;
ifstream fin1("abc1.txt");
cout<<"\n .. Content of file 1 is ..\n";
while(fin1)
{
c=fin1.get();
if ((c>='a' && c<='z')||(c>='A' && c <= 'Z'))
{
alpha++;
if (c=='a' || c=='e'|| c=='i' || c=='o'|| c=='u'||c=='A'||c=='E'||c=='I'||c=='O'||c=='U') vow++;
else conso++;
}
cout<<c;
}
cout<<"\n No of alphabets = "<<alpha<<"... NO. OF VOWELS = "<<vow<<"..NO. OF CONSONANTS = "<<conso;
fin1.close();
getch();
}
#include<stdio.h>
#include<fstream.h>
#include<iostream.h>
#include<string.h>
int main()
{
//clrscr();
cout<<"\n..... A PROG TO COUNT ALPHABETS , CONSONANTS AND VOWELS IN A GIVEN TEXT FILE ....\n";
char c;
int alpha=0,conso=0,vow=0;
ifstream fin1("abc1.txt");
cout<<"\n .. Content of file 1 is ..\n";
while(fin1)
{
c=fin1.get();
if ((c>='a' && c<='z')||(c>='A' && c <= 'Z'))
{
alpha++;
if (c=='a' || c=='e'|| c=='i' || c=='o'|| c=='u'||c=='A'||c=='E'||c=='I'||c=='O'||c=='U') vow++;
else conso++;
}
cout<<c;
}
cout<<"\n No of alphabets = "<<alpha<<"... NO. OF VOWELS = "<<vow<<"..NO. OF CONSONANTS = "<<conso;
fin1.close();
getch();
}