#include <iostream>
int main()
{
float test = 12535104400;
std::cout << test;
std::cin.get();
return 0;
}
//on msvc 2010 this ouputs: 1.25351e+010
我希望它只输出“12535104400”或者换句话说,没有前导零但输出数字的完整值的人类可读格式。
最佳答案
无法准确表示特定数字,例如尝试以下操作:
float v = 12535104400;
cout.precision(0);
cout << fixed << v << endl;
你会看到它输出:12535104512
关于c++ - 如何在 std::cout 中既不以科学形式也不以定点表示法输出 float ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4337642/