我想打印从十六进制值转换的整数值,但我只能打印十六进制值。
#include <iostream>
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
cpp_int dsa("0xFFFFFFFFFFFFFFFF");
cpp_int daa("9223372036854775807");
daa = ((daa * 64) + daa);
cout << std::hex<<dsa <<std::showbase<< endl;
cout <<dsa << endl;
cout <<daa << endl;
cout <<(int)daa << endl;
cout <<(int128_t)daa << endl;
输出
ffffffffffffffff
0xffffffffffffffff
0x207fffffffffffffbf
0x7fffffff
0x207fffffffffffffbf
如何打印 128 位整数类型的最大值?