I am trying to determine how many consonants and vowels are in the string. I have it working with this declaration:
char cString[200];
and with this for loop:
Code:
for(int x = 0; cString[x]!= '\0'; x++)
{
if(cString[x] == 'A'||cString[x] == 'E'||cString[x] == 'I'||cString[x] == 'O'||cString[x] == 'U'||cString[x] == 'Y',
cString[x] == 'a'||cString[x] == 'e'||cString[x] == 'i'||cString[x] == 'o'||cString[x] == 'u'||cString[x] == 'y')
vowels++;
else if (cString[x])
consonants++;
}
this is why I originally wanted to covert from c style to c string, because I already have it looking and returning the # of consonants and vowels correctly.