Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

#include<fstream.

h>
#include<conio.h>
#include<stdio.h>
int n=0;
char ch[101],reply;
fstream file;
void count()
{file.open("file.txt",ios::in);
while(!file.eof())
{file.getline(ch,101);
switch(ch[0])
{
case 'A':
case 'E':
case 'I':
case 'O':
case 'U':n++;
cout<<ch;
} }
file.close();
}
void main()
{clrscr();
file.open("file.txt",ios::out);
do
{cout<<"\nEnter a line(Max 100 characters):";
gets(ch);
file<<ch<<'\n';
cout<<"Do you wish to enter more?(y/n)";
cin>>reply;
}while(reply=='Y'||reply=='y');
file.close();
cout<<"\nLines begining with an uppercase vowel-\n\n";
count();
cout<<"\nNo. of lines begining with an uppercase vowel="<<n;
getch();
}
//OUTPUT
Enter a line(Max 100 characters):Naman Bagga is my name
Do you wish to enter more?(y/n)y

Enter a line(Max 100 characters):I live in India


Do you wish to enter more?(y/n)y

Enter a line(Max 100 characters):Ubuntu 7.10 releases on 18th


Do you wish to enter more?(y/n)Y

Enter a line(Max 100 characters):a is a lowercase vowel


Do you wish to enter more?(y/n)N

Lines begining with an uppercase vowel-

I live in India
Ubuntu 7.10 releases on 18th

No. of lines begining with an uppercase vowel=2

You might also like