求救!不知道哪儿错了.
#include "stdio.h"#define N 8
void input()
{
struct student
{
int num;
char name[18];
struct date
{
int year;
int month;
int day;
}brithday;
char address[50];
float score[4];
float ave;
}stu[N];
int i=0,j;
char flag;
printf("\nDo you want input student's information(y or n):");
scanf("%c",&flag);
while(i<N&&flag=='y')
{
stu[i].num=i+1;
printf("\nPlease input NO.%d student's information:",stu[i].num);
printf("\nAame:");
scanf("%s",stu[i].name);
printf("\nBrithday:");
scanf("%d%d%d",&stu[i].brithday.year,&stu[i].brithday.month,&stu[i].brithday.day);
printf("\nAddress:");
scanf("%s",stu[i].address);
printf("\nScore:");
for(j=0;j<4;j++)
{
scanf("%f",&stu[i].score[j]);
stu[i].ave+=stu[i].score[j];
}
stu[i].ave=stu[i].ave/4;
printf("Do you want continue? y or n.");
scanf("%c",&flag);
getch();
i++;
}
}
运行上面的程序,在输入地址之后程序就不再向下运行了,我找了半天不知道哪儿错了,请哪位高手帮忙找找并解释下,谢谢!