This function is part of a program that I wrote for an assignment. The other parts of the program work well but the vowel counting function only counts one vowel in the input and then stops. Im sure that the fix is easy, Im just drawing a blank at the moment. I was wondering if I need to write a loop in the function so it will continue to check every number or is it something else ?
Here it is:
1 2 3 4 5 6 7 8 9 10 11 12
//Function Name:"countVowels"===================================
int countVowels(string inputString)
{
int i=0;
char letter;
int vowels=0;
letter= inputString [i];
if (letter=='a' || letter=='e' || letter=='i' || letter=='o' || letter=='u'
||letter=='A' || letter=='E' || letter=='I' || letter=='O' || letter=='U')
++vowels;
return vowels;
}