我尝试使用std ::法院打印以下整数< <如何打印整数无小数或科学记数法C++
256 6561 65536 390625 1679616 5764801 16777216 43046721亿
然而如果我用这个,我得到科学记数法:
#include <math.h>
for (int k = 2; k <=10; ++k)
std::cout<< " " << pow(k, 8); //k to the power of 8
256 6561 65536 390625 1.67962e + 06 5.7648e + 06 1.67772e + 07 4.30467e + 07 1E + 08
,如果我使用std ::固定,我收到不需要小数:
for (int k = 2; k <=10; ++k)
std::cout<< std::fixed << " " << pow(k, 8);
256.000000 6561.000000 65536.000000 390625.000000 1679616.000000 5764801.000000 16777216.000000 43046721.000000 100000000.000000
什么我需要做的打印全长整数?
那么['std :: pow'](http://en.cppreference.com/w/cpp/numeric/math/pow)函数*是一个浮点函数。 –