循环问题!!
while(1){
printf("\nPlease enter the car\'s id you want to modify:");
scanf("%ld",&m);
switch(a=(array1[0].id<=m&&m<=array1[t-1].id))
{
case 0:printf("\nError input!\n");break;
case 1:d=search(m,array1);
strcpy(z,array1[d].name);
printf("\n\tPlease enter the name you want:\n");
scanf("%s",array1[d].name);
if(strcmp(z,array1[d].name)==0)
printf("\nFail!");
else
printf("\nSuccessful!");
break;
}
printf("\n\tPress \'Q\' to quit!\n");
s=getchar();
if(s=='q'||s=='Q')
break;
}
这是函数的一部分,为什么这里
printf("\n\tPress \'Q\' to quit!\n");
s=getchar();
if(s=='q'||s=='Q')
break;
不能实现,运行后跳过了s=getchar()之后的语句。