贴串代码 关于c++ cout输出的进制
#include<iostream> using namespace std; int main(void) { int chest=42; int waist=42; int inseam=42; int eils=42; cout << "Monsieur cuts a striking figure!" << endl; cout <<"chest = " << chest << "(decimal for 42)" << endl; cout << hex; cout << "waist = " << waist << "(hexadecimal for 42)" << endl; cout << oct; cout << "inseam = " << inseam << "(octal for 42)" << endl; cout << dec; cout << "eils = " << eils <<"(decimal for 42)" << endl; return 0; }
cout dec;
以十进制输出
cout hex;
以十六进制输出
cout oct;
以八进制输出