From 049e7d4825a6ffbdfd2a80e97ab1e31023070fb9 Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Tue, 13 Sep 2011 21:43:47 -0400 Subject: [PATCH] first working version of ex13 --- ex13.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 ex13.c diff --git a/ex13.c b/ex13.c new file mode 100644 index 0000000..a3fad4e --- /dev/null +++ b/ex13.c @@ -0,0 +1,54 @@ +#include + +int main(int argc, char *argv[]) +{ + if(argc != 2) { + printf("ERROR: You need one argument.\n"); + return 1; + } + + int i = 0; + for(i = 0; argv[1][i] != '\0'; i++) { + char letter = argv[1][i]; + + switch(letter) { + case 'a': + case 'A': + printf("%d: 'A'\n", i); + break; + + case 'e': + case 'E': + printf("%d: 'E'\n", i); + break; + + case 'i': + case 'I': + printf("%d: 'I'\n", i); + break; + + case 'o': + case 'O': + printf("%d: 'O'\n", i); + break; + + case 'u': + case 'U': + printf("%d: 'U'\n", i); + break; + + case 'y': + case 'Y': + if (i > 2) { + printf("%d: 'Y'\n", i); + } + break; + + default: + printf("%d: %c is not a vowel\n", i, letter); + } + } + + return 0; +} +