我试着用 printf()
写一个小数点后两位的数,如下所示:
#include <cstdio>
int main()
{
printf("When this number: %d is assigned to 2 dp, it will be: 2%f ", 94.9456, 94.9456);
return 0;
}
当我运行这个程序时,我会得到以下输出:
# ./printf
When this number: -1243822529 is assigned to 2 db, it will be: 2-0.000000
为什么?
谢谢。