解决方案:50分
#include <stdio.h> #define MAXN 189 double d[MAXN][7]; FILE *f; int i,n; char ln[200]; int main() { f=fopen("in.txt","r"); if (NULL==f) { printf("Can not open file in.txt!\n"); return 1; } fgets(ln,200,f); fgets(ln,200,f); fgets(ln,200,f); for (i=0;i<MAXN;i++) { if (7!=fscanf(f,"%*d%lf%lf%lf%lf%lf%lf%lf",&d[i][0],&d[i][1],&d[i][2],&d[i][3],&d[i][4],&d[i][5],&d[i][6])) break; } fclose(f); n=i; for (i=0;i<n;i++) { printf("%3d %7.3lf %7.3lf %7.3lf %8.3lf %9.3lf %9.3lf %7.5lE\n",i+1,d[i][0],d[i][1],d[i][2],d[i][3],d[i][4],d[i][5],d[i][6])) } return 0; }
本来本人昨天想在LZ发的那个被删的帖子里面救LZ一命的。救人一命胜造七级浮屠。