Last active
January 25, 2018 08:42
-
-
Save HongfeiXu/c2d39deb23b0018b46931dc97f405388 to your computer and use it in GitHub Desktop.
cout Binary\Octal\Hexadecimal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bitset> | |
#include <iostream> | |
using namespace std; | |
void outbin(const int x) { cout << bitset<sizeof(int) * 8>(x) << endl; } // 二进制输出 | |
void outoct(const int x) { cout << oct << x << endl; } // 八进制输出 | |
void outhex(const int x) { cout << hex << x << endl; } // 十六进制输出 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment