请各位高手帮忙,FOR循环只循环了一次
#include #include
struct student
{
char name[20],sex,addr[30];
char tell[11];
float score[3];
struct date
{
int year,month,day;
}birthday;
};
void main()
{
int i,j,n=0;
struct student stu[10];
for(i=0;i<10;i++)
{
printf("第%d个人信息的输入:\n",i+1);
printf("姓名(输入null可以结束输入): ");
gets(stu[i].name);
if(!strcmp(stu[i].name,"null"))
{
n=i;
break;
}
printf("性别(m/f): ");
stu[i].sex=getchar();
strcpy(stu[i].addr,"tianjin");
printf("联系电话: ");
scanf("%s",stu[i].tell);
printf("三门成绩: \n");
for(j=0;j<3;j++)
scanf("%f",&stu[i].score[j]);
printf("出生(yy-mm--dd): ");
scanf("%d-%d-%d",&stu[i].birthday.year,&stu[i].birthday.month,&stu[i].birthday.day);
}
printf("\n");
for(i=0;i