不同进制输出 iostream的代码: #include<iostream> #include<iomanip> using namespace std; int main(){ int a; cin >> a; cout << "dec:" << dec << a << endl;//十进制 cout << "hex:" << hex << a << endl;//十六进制 cout << "oct:" << setbase(8) << a << endl;//八进制 return 0; }