#include <stdio.h> #define STOP '#' int main(void){ char ch; printf("Please input the lower "); printf("input the # to stop. "); while ((ch = getchar()) != STOP){ if (islower(ch)){ switch (ch){ case 'a': printf("apple,a fruit of red. "); break; case 'b': printf("banan, a fruit of yellow. "); break; case 'c': printf("coati, recoonlike mammal. "); break; case 'd': printf("desman,aquatic molelike critter. "); break; case 'e': printf("echidna,the spiny anteater. "); break; case 'f': printf("fisher ,brownish marten. "); break; } } else{ printf("I recongnize only lowercase letters. "); } } printf("Bye! "); return 0; }
REMEBER:
1 continue causes the rest of an iteration to be skipped and the next iteration to be started.
2.break causes the program to break free of the loop that encloses it and to proceed to the next stage of the program.
3 swtich(integer expression1){
case constant1:
statements
break;//depend on your meaning
case constant2:
statements
break;
default:
statements
break;
}