C++ examples for Language Basics:Console
Oct and hex manipulators are used for conversions to octal and hexadecimal
#include <iostream> #include <iomanip> using namespace std; int main()// ww w. j a v a2 s . c o m { cout << "The decimal (base 10) value of 15 is " << 15 << endl; cout << "The octal (base 8) value of 15 is " << showbase << oct << 15 <<endl; cout << "The hexadecimal (base 16) value of 15 is " << showbase << hex << 15 << endl; return 0; }