How do I avoid scientific notation for large numbers?

后端 未结 8 1204
Happy的楠姐
Happy的楠姐 2020-12-15 05:04

I am doing 2^1000 and I am getting this:

1.07151e+301

Is there any way to actually turn this into a proper number without the e+301, or at least can anyone s

8条回答
  •  北荒
    北荒 (楼主)
    2020-12-15 05:48

    Include the header limits.h and cmath.h

    cout.precision(0);
    cout<< fixed<< pow(2,31);               //OR ANY NUMBER HERE
    

    Use cout.precision to set the precision.

提交回复
热议问题