Big number in C++

后端 未结 9 1544
暖寄归人
暖寄归人 2020-12-16 19:13

I am trying to place a big number in a C++ variable. The number is 600851475143

I tried unsigned long long int but got an error saying it the constant was too big.

9条回答
  •  不思量自难忘°
    2020-12-16 19:56

    The number is 600851475143 isn't too large for a long long int but you need to use the LL suffix when using a long long constants (ULL for unsigned long long int):

    unsigned long long int num = 600851475143ULL;
    

提交回复
热议问题