+ 2
Guys can you help me on this, We should create a c program about finding each vowels and consonants in a word put by user
Ex. Word, the output: W-consonant O-vowel R-consonant D-Consonant
20 Antworten
+ 11
Where's your attempt??
+ 5
Here it is, but it only display the first letter of the word
#include <stdio.h>
int main() {
char c;
int lowercase_vowel, uppercase_vowel;
printf("Enter an alphabet: ");
scanf("%c", &c);
// evaluates to 1 if variable c is a lowercase vowel
lowercase_vowel = (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u');
// evaluates to 1 if variable c is a uppercase vowel
uppercase_vowel = (c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U');
// evaluates to 1 (true) if c is a vowel
if (lowercase_vowel || uppercase_vowel)
printf("%c is a vowel.", c);
else printf("%c is a consonant.", c);
return 0;
}
+ 5
Cj Pallar it is the best to move your code to code bits and attach the link in question Description
+ 3
Cj Pallar please paste and save the code in code playground or code bits and then share it here with the community.
Your program is made to read, check and print the result for only one character. Put everything into a loop running till there are no more characters to read:
while( scanf("%c", &c) == 1 ) { ...entire program... }
+ 3
Cj Pallar you can try this solution
https://code.sololearn.com/c8H497NFKrcd/?ref=app
+ 3
Szaky spaces are considered consonant
+ 2
Flash you don't need the variable fV. After you check if c is a vowel you can do just
else if (isalpha(*pS))
{
printf("%c-consonant\n", toupper(*pS));
}
+ 2
Flash you are righ sorry. I should have tried it before telling you anything. I thought the two if were one after the other
+ 2
My solution:
https://code.sololearn.com/cOJVR6tbf82q/?ref=app
+ 2
\n as well is consonant Szaky in your code
+ 1
+ 1
+ 1
well Davide could you post the code? I still think I need it, but show your code so I can see
+ 1
Davide no worries
+ 1
nice Szaky .. a bit different
+ 1
Thanks guys
0
Here it is
0
But it only recognize the first letter of the word