fatal error C1004: unexpected end of file found是怎么回事?

#include"stdio.h"#include"stdlib.h"main(){doublekT10,k10,suscepm0,averagem0,averagemA... #include "stdio.h"
#include "stdlib.h"

main()
{ double kT10,k10,suscepm0,averagem0,averagemA0,averagemB0,Chime20,HM0,HME0,HTOT0;
double kT20,k20,polar0,averagep0,averagepA0,averagepB0,Chime10,HE0,p20,pp0;

double kT12,k12,suscepm2,averagem2,averagemA2,averagemB2,Chime22,HM2,HME2,HTOT2;
double kT22,k22,polar2,averagep2,averagepA2,averagepB2,Chime12,HE2,p22,pp2;

double kT14,k14,suscepm4,averagem4,averagemA4,averagemB4,Chime24,HM4,HME4,HTOT4;
double kT24,k24,polar4,averagep4,averagepA4,averagepB4,Chime14,HE4,p24,pp4;

FILE *fp00,*fp10,
*fp02,*fp12,
*fp04,*fp14,
*fp21,*fp31,*fp41;

if((fp00=fopen("susceps(g=0).dat","r"))==NULL) {printf("cannot open susceps(g=0).dat\n");exit(0);}
if((fp10=fopen("pr(g=0).dat","r"))==NULL) {printf("cannot open pr(g=0).dat\n");exit(0);}

if((fp02=fopen("susceps(g=2).dat","r"))==NULL) {printf("cannot open susceps(g=2).dat\n");exit(0);}
if((fp12=fopen("pr(g=2).dat","r"))==NULL) {printf("cannot open pr(g=2).dat\n");exit(0);}

if((fp04=fopen("susceps(g=4).dat","r"))==NULL) {printf("cannot open susceps(g=4).dat\n");exit(0);}
if((fp14=fopen("pr(g=4).dat","r"))==NULL) {printf("cannot open pr(g=4).dat\n");exit(0);}

if((fp21=fopen("kT-M1.txt","a"))==NULL) {printf("cannot open kT-M1.txt\n");exit(0);}
if((fp31=fopen("kT-Xm1.txt","a"))==NULL) {printf("cannot open kT-Xm1.txt\n");exit(0);
if((fp41=fopen("kT-P1.txt","a"))==NULL) {printf("cannot open kT-P1.txt\n");exit(0);}

for(int i=0;i<50;i++)
{
//read the datas;
fscanf(fp00,"%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf",&kT10,&k10,&suscepm0,&averagem0,&averagemA0,&averagemB0,&Chime20,&HM0,&HME0,&HTOT0);
fscanf(fp10,"%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf",&kT20,&k20,&polar0,&averagep0,&averagepA0,&averagepB0,&Chime10,&HE0,&p20,&pp0);

fscanf(fp02,"%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf",&kT12,&k12,&suscepm2,&averagem2,&averagemA2,&averagemB2,&Chime22,&HM2,&HME2,&HTOT2);
fscanf(fp12,"%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf",&kT22,&k22,&polar2,&averagep2,&averagepA2,&averagepB2,&Chime12,&HE2,&p22,&pp2);

fscanf(fp04,"%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf",&kT14,&k14,&suscepm4,&averagem4,&averagemA4,&averagemB4,&Chime24,&HM4,&HME4,&HTOT4);
fscanf(fp14,"%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf",&kT24,&k24,&polar4,&averagep4,&averagepA4,&averagepB4,&Chime14,&HE4,&p24,&pp4);

//input the datas;
fprintf(fp21,"%f %f %f %f\n",kT10,averagem0,averagem2,averagem4);
fprintf(fp31,"%f %f %f %f\n",kT10,suscepm0,suscepm2,suscepm4);
fprintf(fp41,"%f %f %f %f\n",kT12,averagep0,averagep2,averagep4);

} //end for the cycle;

//close the files;
fclose(fp00);
fclose(fp10);
fclose(fp02);
fclose(fp12);
fclose(fp04);
fclose(fp14);

fclose(fp21);
fclose(fp31);
fclose(fp41);
fclose(fp51);
fclose(fp61);
fclose(fp71);
}
出错提示老是在最后一行。显示:fatal errorC1004:unexpected end of file found
这个程序的目的是从几个dat文件中读取数据到一个文件中。
展开
 我来答
wanfustudio
推荐于2017-10-10 · TA获得超过1万个赞
知道大有可为答主
回答量:5513
采纳率:100%
帮助的人:3760万
展开全部
  #include "stdio.h"
  #include "stdlib.h"

  main()
  {
  double kT10,k10,suscepm0,averagem0,averagemA0,averagemB0,Chime20,HM0,HME0,HTOT0;
  double kT20,k20,polar0,averagep0,averagepA0,averagepB0,Chime10,HE0,p20,pp0;

  double kT12,k12,suscepm2,averagem2,averagemA2,averagemB2,Chime22,HM2,HME2,HTOT2;
  double kT22,k22,polar2,averagep2,averagepA2,averagepB2,Chime12,HE2,p22,pp2;

  double kT14,k14,suscepm4,averagem4,averagemA4,averagemB4,Chime24,HM4,HME4,HTOT4;
  double kT24,k24,polar4,averagep4,averagepA4,averagepB4,Chime14,HE4,p24,pp4;

  FILE *fp00,*fp10,
  *fp02,*fp12,
  *fp04,*fp14,
  *fp21,*fp31,*fp41,*fp51,*fp61, *fp71;///////////////////////////////////少了fp51,fp61,fp71

  if((fp00=fopen("susceps(g=0).dat","r"))==NULL) {printf("cannot open susceps(g=0).dat\n");exit(0);}
  if((fp10=fopen("pr(g=0).dat","r"))==NULL) {printf("cannot open pr(g=0).dat\n");exit(0);}

  if((fp02=fopen("susceps(g=2).dat","r"))==NULL) {printf("cannot open susceps(g=2).dat\n");exit(0);}
  if((fp12=fopen("pr(g=2).dat","r"))==NULL) {printf("cannot open pr(g=2).dat\n");exit(0);}

  if((fp04=fopen("susceps(g=4).dat","r"))==NULL) {printf("cannot open susceps(g=4).dat\n");exit(0);}
  if((fp14=fopen("pr(g=4).dat","r"))==NULL) {printf("cannot open pr(g=4).dat\n");exit(0);}

  if((fp21=fopen("kT-M1.txt","a"))==NULL) {printf("cannot open kT-M1.txt\n");exit(0);}
  if((fp31=fopen("kT-Xm1.txt","a"))==NULL) {printf("cannot open kT-Xm1.txt\n");exit(0);
  if((fp41=fopen("kT-P1.txt","a"))==NULL) {printf("cannot open kT-P1.txt\n");exit(0);}

  for(int i=0;i<50;i++)
  {
  //read the datas;
  fscanf(fp00,"%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf",&kT10,&k10,&suscepm0,&averagem0,&averagemA0,&averagemB0,&Chime20,&HM0,&HME0,&HTOT0);
  fscanf(fp10,"%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf",&kT20,&k20,&polar0,&averagep0,&averagepA0,&averagepB0,&Chime10,&HE0,&p20,&pp0);

  fscanf(fp02,"%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf",&kT12,&k12,&suscepm2,&averagem2,&averagemA2,&averagemB2,&Chime22,&HM2,&HME2,&HTOT2);
  fscanf(fp12,"%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf",&kT22,&k22,&polar2,&averagep2,&averagepA2,&averagepB2,&Chime12,&HE2,&p22,&pp2);

  fscanf(fp04,"%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf",&kT14,&k14,&suscepm4,&averagem4,&averagemA4,&averagemB4,&Chime24,&HM4,&HME4,&HTOT4);
  fscanf(fp14,"%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf",&kT24,&k24,&polar4,&averagep4,&averagepA4,&averagepB4,&Chime14,&HE4,&p24,&pp4);

  //input the datas;
  fprintf(fp21,"%f %f %f %f\n",kT10,averagem0,averagem2,averagem4);
  fprintf(fp31,"%f %f %f %f\n",kT10,suscepm0,suscepm2,suscepm4);
  fprintf(fp41,"%f %f %f %f\n",kT12,averagep0,averagep2,averagep4);

  } //end for the cycle;

  //close the files;
  fclose(fp00);
  fclose(fp10);
  fclose(fp02);
  fclose(fp12);
  fclose(fp04);
  fclose(fp14);

  fclose(fp21);
  fclose(fp31);
  fclose(fp41);
  fclose(fp51);
  fclose(fp61);
  fclose(fp71);
  }
  }///////////////////////////////////////////////////////////少了这个扩号
甜美互动屋
2019-04-26 · TA获得超过3776个赞
知道大有可为答主
回答量:3079
采纳率:30%
帮助的人:252万
展开全部
晕了,你在定义disp()时少了一个右大括号},在disp()输出c的时候也少了<<
加上之后
还需把类中定义的方法定义成公有的public
…………楼主有些马虎哦~~下面是调试通过的头文件代码
#include
<iostream.h>
class
equation{
float
a,b,c,r;
public:void
setData(float
a1,float
b1,float
c1){
a=a1;b=b1;c=c1;
}
int
getA(){
return
a;
}
int
getB(){
return
b;
}
int
getC(){
return
c;
}
float
result(float
x){
r=a*x*x+b*x+c;
return
r;
}
void
disp(){
cout<<"a:"<<a<<endl;
cout<<"b:"<<b<<endl;
cout<<"c:"<<c<<endl;
cout<<"the
result
is:"<<r<<endl;
}
};
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
蹇红辉平惠
2020-05-28 · TA获得超过3681个赞
知道大有可为答主
回答量:3102
采纳率:33%
帮助的人:433万
展开全部
修改为如下即可:
#include
<stdio.h>
void
main()
//将viod改为void
{
char
c1='a',c2='b',c3='c',c4='\101',c5='\116';
printf("a%c
b%c\tc%c\tabc\n",c1,c2,c3);
printf("\t
\b%c
%c\n",c4,c5);
}
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
果豪郭轩秀
2019-09-27 · TA获得超过3738个赞
知道大有可为答主
回答量:3130
采纳率:33%
帮助的人:202万
展开全部
你的pai函数后面少个}
就这个原因
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
覃宸都清芬
2019-03-14 · TA获得超过4232个赞
知道大有可为答主
回答量:3102
采纳率:24%
帮助的人:176万
展开全部
少个“}”,加到最后就可以了。
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(3)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式