I am trying to write a program that will remove vowels from an input string and output only consanants. I've looked all over for resources and coding examples that would point me in the right direction. Currently my function is written with a case statement, but as this is my first attempt at integrating a function into a program, I am missing something. Unfortunately, I dont know what that is.
What I am thinking at the moment is I have my function built, and I currently coded a while statement to capture the text and output back to the screen. The problem is I have no idea how to properly have the function intercept each character and remove a vowel.
Here is my code such as it is:
I think I should be using an if statement to seperate the vowels, but at this point, Im not sure how that is accomplished.Code:#include <stdio.h>
int isvowel()
{
// Switch on the character
switch (c) {
// Character is a vowel
case 'A': case 'E': case 'I':
case 'O': case 'U': case 'Y':
case 'a': case 'e': case 'i':
case 'o': case 'u': case 'y':
return true;
// Character is not a vowel
default:
return false;
}
int main(void)
{
int c; // character variable integer initialized
printf("This program will strip all vowels from input text and print the output\n"); // printed messages
printf("Enter some text ;-)\n\n");
while ((c = getchar()) != EOF) { // while statement to capture characters
// my function goes here but I dont know yet how to code it properly
printf("\n"); // prints out characters
putchar(c);
}