C++转换

来源:互联网 发布:淘宝网天猫女手提包 编辑:程序博客网 时间:2024/06/17 07:05
#include <iostream>
#include <stdlib.h>
using namespace std;

int main(void){
    cout << "请输入一个整数:" << endl;
    int x = 0;
    cin >> x;
    cout <<"  八进制:"<< oct << x << endl;
    cout <<"  十进制:"<< dec << x << endl;
    cout <<"十六进制:"<< hex << x << endl;
    cout << "请输入一个布尔值:" << endl;
    bool y = false;
    cin >> y;
    cout << boolalpha << y << endl;
    system("pause");
    return 0;
}
0 0
原创粉丝点击