Write a program that will count of A's , E's , I's , O's , and U's in a sentence.
Answers
Answer:
I am sure this may have happened in a chinese restaurant but the dawn was the dawn of a new York restaurant in a restaurant in a small town in india where it 4AM and green and the city was in its first season and the first of the first
I have written a C++ program for your above question. Kindly have a look over it.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int i,j,k,l,m,v,va=0,ve=0,vi=0,vo=0,vu=0;
char str[1000];
cout<<"Enter a sentence."<<endl;
cin.getline(str,1000);
for(i=0;str[i]!='\0';i++)
{
if(str[i] == 'a' || str[i] == 'A')
va++;
}
for(j=0;str[j]!='\0';j++)
{
if(str[j] == 'e' || str[j] == 'E')
ve++;
}
for(k=0;str[k]!='\0';k++)
{
if(str[k] == 'i' || str[k] == 'I')
vi++;
}
for(l=0;str[l]!='\0';l++)
{
if(str[l] == 'o' || str[l] == 'O')
vo++;
}
for(m=0;str[m]!='\0';m++)
{
if(str[m] == 'u' || str[m] == 'U')
vu++;
}
{
cout<<"Number of A's in the given sentence is "<<va<<endl;
cout<<"Number of E's in the given sentence is "<<ve<<endl;
cout<<"Number of I's in the given sentence is "<<vi<<endl;
cout<<"Number of O's in the given sentence is "<<vo<<endl;
cout<<"Number of U's in the given sentence is "<<vu<<endl;
}
v=va+ve+vi+vo+vu;
cout<<"Total number of vowels in the given sentence is " <<v;
getch();
}
#answerwithquality #BAL