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; }
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/279040.html