我很难打印浮点变量。它给了我额外的数字,那不应该在那里。这是示例:
float number;
char temp[50];
fgets ( temp, sizeof temp, fr ); //reading string from file, example: 99.10
number=atof(temp);
printf("%lf",number); //console output: 99.101563
这显然是错误的输出。有什么建议么?
我很难打印浮点变量。它给了我额外的数字,那不应该在那里。这是示例:
float number;
char temp[50];
fgets ( temp, sizeof temp, fr ); //reading string from file, example: 99.10
number=atof(temp);
printf("%lf",number); //console output: 99.101563
这显然是错误的输出。有什么建议么?