I know how to determine vowel in a string but i not sure how to change the code to make it determine the non-vowel in a string and display it out... Anyone got any idea??
#include<iostream.h>
void main()
{
char word[20];
int vowel = 0;
cout<<"Enter a name: ";
cin>>word;
Currently, the if statement is always entered because if it != 'a' then it will be entered, and if it is 'a', then it is obviously not 'e', so the if is entered anyway.
Look at your statement again and read it to yourself...your logic is a bit off.
char vowels[5] = {'a', 'e', 'i', 'o', 'u'};
int i = 0, x = 0;
for(i; i < strlen(word); i++) {
for(x; x < 5; x++)
if(!strcmp(word[i], vowels[x]))
... // output vowel
x = 0; // set x = 0 again for the next letter to be tested
}