纠结的default问题
#include<stdio.h>char b[9];
void writeinfo()
{
printf("Enter stock name:");
scanf("%s",b);
printf("How much did you pay for it?");
scanf("%s",b);
puts("stock added\n");
}
int main()
{
int is_Quit = 1;
char a;
while(is_Quit)
{
puts("Stock Portfolio Thing\n");
puts("A - Add newstock");
puts("L - List stocks");
puts("R - Replace stocka");
puts("Q - Quit\n");
printf("Your choice:");
scanf("%c",&a);
switch(a)
{
case 'A' :
case 'a' :
puts("Add newstock\n");
writeinfo();
break;
case 'L' :
case 'l' :
puts("List stocks\n");
break;
case 'R' :
case 'r' :
puts("Replace stocka\n");
break;
case 'Q' :
case 'q' :
puts("Quit\n");
is_Quit = 0;
break;
default :
puts("Error\n");
break;
}
}
getch(); return(0);
}
为什么因老是进入default而无法循环呢???纠结啊。。。