Last active
December 22, 2015 11:29
-
-
Save adamzaninovich/6465946 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdbool.h> | |
#include <string.h> | |
bool is_vowel(char arg) { | |
int i; | |
char vowels[] = "aeiou"; | |
if(arg < 91) arg += 32; | |
for (i = 0; i < strlen(vowels); ++i) { | |
if (arg == vowels[i]) return true; | |
} | |
return false; | |
} | |
void print_char(char letter) { | |
if(is_vowel(letter)) { | |
printf("Vowel: %c\n", letter); | |
} else { | |
printf("%c\n", letter); | |
} | |
} | |
void print_vowels_in_word(char *word) { | |
int i; | |
for(i = 0; i < strlen(word); ++i) print_char(word[i]); | |
} | |
int main(int argc, char *argv[]) { | |
char word[10]; | |
char quit[] = "exit"; | |
while(strncmp(word, quit, 4)) { | |
print_vowels_in_word(word); | |
puts("Enter a message:"); | |
fgets(word, 10, stdin); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment