hex cout.setf(ios::hex,ios::basefield); cout << "hex:" << myInt << endl; cout.setf(ios::oct,ios::basefield); oct cout << "octal:" << myInt << endl; Print integer as decimal Print integer as hexadecimal Print integer as octal cout<< std::hex<< std::showbase<< 13 << '\...
cout << "0x" << hex << (unsigned short)((unsigne d char) *iter) << " "; } The *iter is char, not unsigned char. So, I have to use double casting to do the job. If I use c-style function, I can easily specify "%x" in the format string of printf() to print the char...