back to using switch
This commit is contained in:
parent
9f7dd8283f
commit
d4c567fd4d
49
ex13.c
49
ex13.c
@ -22,24 +22,37 @@ 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) {
|
||||||
printf("%d: 'a'\n", i);
|
case 'a':
|
||||||
} else if (letter == 'e') {
|
printf("%d: 'a'\n", i);
|
||||||
printf("%d: 'e'\n", i);
|
break;
|
||||||
} else if (letter == 'i') {
|
|
||||||
printf("%d: 'i'\n", i);
|
case 'e':
|
||||||
} else if (letter == 'o') {
|
printf("%d: 'e'\n", i);
|
||||||
printf("%d: 'o'\n", i);
|
break;
|
||||||
} else if (letter == 'u') {
|
|
||||||
printf("%d: 'u'\n", i);
|
case 'i':
|
||||||
} else if (letter == 'y') {
|
printf("%d: 'i'\n", i);
|
||||||
if (i > 2) {
|
break;
|
||||||
printf("%d: 'Y'\n", i);
|
|
||||||
} else {
|
case 'o':
|
||||||
printf("%d: 'Y' isn't a vowel this time\n", i);
|
printf("%d: 'o'\n", i);
|
||||||
}
|
break;
|
||||||
} else {
|
|
||||||
printf("%d: '%c' is not a vowel\n", i, letter);
|
case 'u':
|
||||||
|
printf("%d: 'u'\n", i);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'y':
|
||||||
|
if (i > 2) {
|
||||||
|
printf("%d: 'Y'\n", i);
|
||||||
|
} else {
|
||||||
|
printf("%d: 'Y' isn't a vowel this time\n", i);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
printf("%d: '%c' is not a vowel\n", i, letter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user