back to using switch
This commit is contained in:
parent
9f7dd8283f
commit
d4c567fd4d
27
ex13.c
27
ex13.c
@ -22,23 +22,36 @@ int main(int argc, char *argv[])
|
|||||||
letter = (char)(i_letter + up_low_sep);
|
letter = (char)(i_letter + up_low_sep);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (letter == 'a') {
|
switch(letter) {
|
||||||
|
case 'a':
|
||||||
printf("%d: 'a'\n", i);
|
printf("%d: 'a'\n", i);
|
||||||
} else if (letter == 'e') {
|
break;
|
||||||
|
|
||||||
|
case 'e':
|
||||||
printf("%d: 'e'\n", i);
|
printf("%d: 'e'\n", i);
|
||||||
} else if (letter == 'i') {
|
break;
|
||||||
|
|
||||||
|
case 'i':
|
||||||
printf("%d: 'i'\n", i);
|
printf("%d: 'i'\n", i);
|
||||||
} else if (letter == 'o') {
|
break;
|
||||||
|
|
||||||
|
case 'o':
|
||||||
printf("%d: 'o'\n", i);
|
printf("%d: 'o'\n", i);
|
||||||
} else if (letter == 'u') {
|
break;
|
||||||
|
|
||||||
|
case 'u':
|
||||||
printf("%d: 'u'\n", i);
|
printf("%d: 'u'\n", i);
|
||||||
} else if (letter == 'y') {
|
break;
|
||||||
|
|
||||||
|
case 'y':
|
||||||
if (i > 2) {
|
if (i > 2) {
|
||||||
printf("%d: 'Y'\n", i);
|
printf("%d: 'Y'\n", i);
|
||||||
} else {
|
} else {
|
||||||
printf("%d: 'Y' isn't a vowel this time\n", i);
|
printf("%d: 'Y' isn't a vowel this time\n", i);
|
||||||
}
|
}
|
||||||
} else {
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
printf("%d: '%c' is not a vowel\n", i, letter);
|
printf("%d: '%c' is not a vowel\n", i, letter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user