楼上说的是对的,回车也会被scanf当做字符进行处理的,所以第二次不等你输入,scanf就会把回车当做自己的字符。改进方法如下:#include struct person{ char name; int count;}leader[3]={'l',0,'z',0,'x',0}; int main(){int i,j;char k;for(i=0;i<5;i++){ printf("Please input the first word of the name:"); scanf("%c",&k);if(k=='\n')
...
|