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.
ビットセット ライブラリを使用して Dec をバイナリに変換する方法があることは知っていますが、ビットセット ライブラリを使用してバイナリから 10 進数に同じことを行うことはできますか? それとも手動で行う必要がありますか?
bitset<8> bin_x(number);
できますが、文字列にする必要があります。
std::bitset<8> bits("1111"); std::cout << bits.to_ulong() << std::endl;
整数を文字列に変換してからbitsetc-tor に渡すことができます。
bitset
実際の例