Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
这是我要更改的代码
string binary = "000000100001000100010000000100000" bitset<32> set(binary); cout << hex << set.to_ulong() << endl;
代码显示 2112010,但我希望它显示 02112010。
std::cout << std::setfill('0') << std::setw(5) << i << std::endl;
这是相同的数字,如果您需要保留零,您可以使用格式说明符将其格式化为 0,您需要将其存储为字符串,