I
interpim
Just a quick exercise from my C programming book, that I can't figure out why it isn't working properly. It kinda works but im getting wierd output. It is supposed to remove the vowels from text.
#include <ctype.h>
#include <stdio.h>
int isvowel(int letter);
int main(void)
{
int letter;
while ((letter = getchar()) != EOF) {
if (isalpha(letter)) {
if (isvowel(letter))
getchar(letter);
else putchar(letter);
}
else putchar(letter);
}
return 0;
}
int isvowel(int letter)
{
if ( letter == 'A' || letter == 'E' || letter == 'I' || letter == 'O' || letter == 'U'
|| letter == 'a' || letter == 'e' || letter == 'i' || letter == 'o' || letter == 'u')
return 1;
return 0;
}
#include <ctype.h>
#include <stdio.h>
int isvowel(int letter);
int main(void)
{
int letter;
while ((letter = getchar()) != EOF) {
if (isalpha(letter)) {
if (isvowel(letter))
getchar(letter);
else putchar(letter);
}
else putchar(letter);
}
return 0;
}
int isvowel(int letter)
{
if ( letter == 'A' || letter == 'E' || letter == 'I' || letter == 'O' || letter == 'U'
|| letter == 'a' || letter == 'e' || letter == 'i' || letter == 'o' || letter == 'u')
return 1;
return 0;
}