C++进制转换

来源:互联网 发布:天谕白色头发数据 编辑:程序博客网 时间:2024/06/04 19:50
#include<iostream>#include<bitset>using namespace std;int main(){    int n;    cout << "Please enter a decimal number :" << endl;    cin >> n;    bitset<8>bs(n);    cout <<"Binary : "<<bs << endl;    cout <<"Octal : "<<oct<<n<<endl;    cout <<"Decimal : "<<dec << n << endl;    cout <<"Hexadecimal : "<< hex << n << endl;    return 0;}
0 0
原创粉丝点击