#include<stdio.h>
int main(void)
{
float aboat = 32000.0;
double abet = 2.14e9;
long double dip = 5.32e5;
printf("%f can be written %e\n", aboat, aboat);
printf("and it is %a in hexadecimal, power of 2 notation\n",aboat);
printf("%f can be written %e\n", abet ,abet);
printf("%Lf can be written %Le \n",dip , dip);
return 0;
}

程序中最后一行输出的数值与书中不符,这是为啥?????
本文探讨了一段C语言代码中,浮点数在控制台的输出问题,特别是float和double类型数值的显示差异,以及如何使用printf函数的不同格式进行正确输出。

被折叠的 条评论
为什么被折叠?



