#include<fstream.h>
#include<iostream.h>
#include<ctype.h>
#include<conio.h>
void main()
{
char fname[30],lname[30];
int c=0;
char ch;
clrscr();
cout<<"Enter First Name = ";
cin>>fname;
cout<<"Enter Last Name = ";
cin>>lname;
ofstream ostud("stud.asa", ios::out);
ostud<<fname<<"\n"<<lname;
ostud.close();
ifstream istud("stud.asa",ios::in);
while(istud>>ch)
{
ch=tolower(ch);
if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')
{
c++;
}
}
cout<<"Number of vowels in file are = "<<c;
istud.close();
getch();
}
/*
OUTPUT:-
Enter First Name = ARJUN
Enter Last Name = SINGH
Number of vowels in file are = 3
*/
Awesome
ReplyDeletenyc....
ReplyDeletePost a Comment