c++ - Printing std::bitset in C++11 -
consider following code written in c++11:
#include <iostream> #include <bitset> #include <cstdint> int main() { std::uint64_t = 0000000000000000000000000000000000000000000000001111111100000000; std::bitset<64> b(a); std::cout << b << std::endl; return 0; } the output of code :
0000000000000000001001001001001001001001000000000000000000000000 why output not correspond a value?
if want write binary number need use 0b prefix.
std::uint64_t = 0b0000000000000000000000000000000000000000000000001111111100000000; std::bitset<64> b(a);
Comments
Post a Comment