写一个学生信息录入程序 出了一点错 帮忙看一下
#include<stdio.h>#include<stdlib.h>
#define N 20
typedef struct student
{
long ID;
char name;
int height;
int weight;
int score[4];
} STUDENT;
void InputMassage(STUDENT stu[] );
void writeToFile(STUDENT stu[] );
int main()
{
STUDENT stu[N];
printf("Input 20 students' massage:\n");
InputMassage(stu);
writeToFile(stu);
return 0;
}
void InputMassage( STUDENT stu[])
{
int i, j;
for( i=0; i<2; i++ )
{
scanf("%ld",&stu[i].ID);
scanf("%s",&stu[i].name);
scanf("%d",&stu[i].height);
scanf("%d",&stu[i].weight);
for( j=0; j<4; j++ )
{
scanf("%d",&stu[i].score[j]);
}
}
}
void writeToFile( STUDENT stu[] )
{
int i, j;
FILE *fp;
fp = fopen("d:\\学生信息.txt","w");
if( fp==NULL )
{
printf("Failure to write to file!\n");
exit(0);
}
for( i=0; i<2; i++ )
{
fprintf(fp,"%10ld%8s%5d%5d",stu[i].ID,stu[i].name,stu[i].height,stu[i].weight);
for( j=0; j<4; j++ )
{
fprintf(fp,"%4d",stu[i].score[j]);
}
}
fclose(fp);
}