The assignment is: Write a program that reads in text one character at a time and counts the
number of vowels ’a’, ’e’, ’i’, ’o’ and ’u’ in the text. Both lower case and upper case vowels
should be counted together. Hint: you may find it useful to use five separate counters. When a
period or question mark appears in the input text, the program prints the number of each vowel
and halts.
#include<iostream>
#include<cmath>
usingnamespace std;
main ()
{
int a(0);
int e(0);
int i(0);
int o(0);
int u(0);
char c;
cout<<"Enter text (ending in '.' or '?'): ";
cin>>c;
while(c!='.' && c!='?')
{
if (c == 'a'|| 'A')
{a++;}
if (c == 'e' || 'E')
{e++;}
if (c == 'i' || 'I')
{i++;}
if (c == 'o' || 'u')
{o++;}
if (c == 'u' || 'U')
{u++;}
}
cout<<"Number of a's: "<<a;
cout<<"Number of e's: "<<e;
cout<<"Number of i's: "<<i;
cout<<"Number of o's: "<<o;
cout<<"Number of u's: "<<u;
return 0;
}
If anyone could help me or give me hints that would be great.