main ()
{
int count [6] = {0, 0, 0, 0, 0}, i = 0;
char data [25] = "This is an test for vowels";
char c = data [0];
while (c!=’\0′)
{
switch (c)
{
case ‘a’:
count [0]++;
break;
case ‘e’:
count [1]++;
break;
case ‘i’:
count [2]++;
break;
case ‘o’:
count [3]++;
break;
case ‘u’
count [4]++;
break;
}
i++;
c = data [i];
}
cout << "count of a: " << count[0] << "\n";
cout << "count of e: " << count[1] << "\n";
cout << "count of i: " << count[2] << "\n";
cout << "count of o: " << count[3] << "\n";
cout << "count of u: " << count[4] << "\n";
cout << "Total no. of vowels << count [0] + count [1] + count [2] + count [3] + count [4];
}
