#include"stdio.h" main(){ FILE * new; FILE * out; int i=0,j; float ik[18]; clrscr(); if((new=fopen("data.data","r"))==NULL)exit(0); out=fopen("out.data","w"); for(j=0;j<18;j++){ fscanf(new,"%9.5f ",&ik[j]); printf("%f\n",ik[j]); fprintf(out,"%9.5f ",ik[j]); i++; if(i%9==0)fprintf(out,"\n"); } fclose(new); fclose(out); }
那位前辈指点一下,这段程序那里出错,为什么结果总是错误的,望不惜赐教,wanghengwu_2000@163.com
1.00000 2.00000 3.00000 4.00000 5.00000 6.00000 7.00000 8.00000 9.00000 9.00000 8.00000 7.00000 6.00000 5.00000 4.00000 3.00000 2.00000 1.00000