结构体问题,但感觉是我的循环出了问题
}stu[N];int main()
{
struct student stu[N];
int i=0;
int index,count;
printf("Please enter the name:");
while(i<N&&gets(stu[i].name)!=NULL)
{
printf("Please enter the number:");
gets(stu[i].num);
printf("Please enter the sorce:");
for(index=0;index<4;index++)
{
scanf("%d",&stu[i].sorce[index]);
}
i++;
if(i<N)printf("Please enter next name:");
}
printf("Here is the list of students:\n");
for(index=0;index<i;index++)
{
puts(stu[index].name);
printf("\n");
puts(stu[index].num);
printf("\n");
for(count=0;count<4;count++)
printf("%d ",stu[index].sorce[count]);
printf("\n");
}
return 0;
}
不知道为什么,第二次循环的时候,name的输入应该是不进行了。求指点