各位大虾们帮我看看问题在哪里?满头大汗的等待ing!
#include <stdio.h>#include "head.h"
main()
{
struct student s[5];
int i;
FILE *fp1,*fp2;
fp1=fopen("zhang.txt","r");
fp2=fopen("ju.txt","w");
for(i=0;i<=4;i++)
{
fscanf(fp1,"%s",s[i].name);
fscanf(fp1,"%d",&s[i].id);
fscanf(fp1,"%lf",&s[i].politics);
fscanf(fp1,"%lf",&s[i].english);
fscanf(fp1,"%lf",&s[i].math);
fscanf(fp1,"%lf",&s[i].special);
s[i].cheng_ji=s[i].english+s[i].math+s[i].politics+s[i].special;
}
fprintf(fp2,"name\t\tid\tpol\teng\tmat\tspe\tche\n");
for(i=0;i<=4;i++)
{
fprintf(fp2,"%s\t",s[i].name);
fprintf(fp2,"%d\t",s[i].id;
fprintf(fp2,"%g\t",s[i].politics);
fprintf(fp2,"%g\t",s[i].english);
fprintf(fp2,"%g\t",s[i].math);
fprintf(fp2,"%g\t",s[i].special);
fprintf(fp2,"%g\t",s[i].cheng_ji);
}
}
另外head.h的头文件如下:struct student
{
char name[30];
int id;
double politics;
double english;
double math;
double special;
double cheng_ji;
}
编译和运行均出现如下提示:f:\c 语言程序\two\main.c(4) : error C2059: syntax error : 'PCH creation point',希望高手给予解答。zhang.txt文件已建,名称为zhang。