#include <iostream>
using std::cout;
using std::endl;
using std::hex;
using std::oct;
using std::showbase;
int main()
{
int x = 100;
cout << "Printing integers preceded by their base:" << endl << showbase;
cout << x << endl; // print decimal value
cout << oct << x << endl; // print octal value
cout << hex << x << endl; // print hexadecimal value
return 0;
}
|