程序代码:
int get_choice(void)
{
const char choiceList[] = "abcdq";
int ch;
printf("\n");
printf("A.add \tB.subtract\n");
printf("C.multiply\tD.divide\n");
printf("Q.quit\n");
printf("Please the operation of your choice:");
do
{
ch = tolower(_getch());
} while (!strchr(choiceList, ch));
_putch(ch);
return ch;
}
