cout默认以十进制格式显示整数
cout << oct和cout << hex不会显示出来,而只是修改cout显示整数的方式
使用std::hex和std::oct时,可以将hex和oct当做变量名,否则不可以
#include<iostream>
int main()
{
int a;
std::cout << "please input the value of a:";
std::cin >> a;
std::cout << "a = " << a << std::endl;
std::cout << std::hex;
std::cout << "a(hex) = " << a << std::endl;
std::cout << std::oct;
std::cout << "a(oct) = " << a << std::endl;
return 0;
}