c++

dec、hex、oct

cout利用控制符dec、hex、oct分别输出dec、hex、out进制,具体哪个是哪个你查查字典吧~

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
void (){

int a = 42;

cout<<"a = "<<a<<endl;

cout<<hex; //十六进制

cout<<"a = "<<a<<endl;

cout<<oct; //八进制

cout<<"a = "<<a<<endl;

}
Share