#include <stdio.h>
int main()
{
FILE *fp = fopen("b3lyp.dat", "r");
float t[13];
double y[13];
for(int i=0; i<13; i++){
if (feof(fp))
break;
fscanf(fp,"%lf %ld",&t[i],&y[i]);
printf("%lf %ld\n", &(t[i]),&(y[i]));
}
}
我想通过上面的程序阅读下面的数据,
1.04981 0.043781274601002
1.06981 0.029635536304994
1.08981 0.018682198951012
1.10981 0.010554297987994
1.12981 0.004922853528996
1.14981 0.001492913057007
1.16981 0
1.18981 0.000206935596992
1.20981 0.001900993164014
1.22981 0.00489135292699
1.24981 0.009006824127994
1.26981 0.014093809840006
1.28981 0.020014492864988
虽然我总是得到如下的printf。我想将数据读入long float或double precision, 什么应该是正确的方法?谢谢你的帮助
0.000000 0.000000
0.000000 0.000000
0.000000 0.000000
0.000000 0.000000
0.000000 0.000000
0.000000 0.000000
0.000000 0.000000
0.000000 0.000000
0.000000 0.000000
0.000000 0.000000
0.000000 0.000000
0.000000 0.000000
0.000000 0.000000