C++ 进制表达法

#include 
#include 
#include 
#include 
using namespace std;

int main()
{

    //    int c = 0x12; //16进制
    int c = 010; // 8进制表示
    cout << "c = " << c << endl;
    cout << "hex = " << hex << c << endl;
    cout << "dec = " << dec << c << endl;
    cout << "oct = " << oct << c << endl;
    //二进制
    cout << "bin = " << bitset<2>(c) << endl;

    cout << (unsigned int)c << endl;

    //整形转为 unsigned char
    return 0;
};

你可能感兴趣的:(c++,算法,开发语言)