C++中,如果进行二进制转换
#include<iostream> #include<bitset> using namespace std; #define unsigned int uint32_t void transferRadix(int n){ cout << "hex: " << std::hex << n << endl; cout << "dec: " << std::dec << n << endl; cout << "oct: " << std::oct << n << endl; cout << "binary: " << bitset<32>(n) << endl; } int main() { int n = 10800; transferRadix(n); transferRadix(n>>8); return 0; }