12345678910111213141516171819 |
- // hexoct2.cpp -- display values in hex and octal
- #include <iostream>
- using namespace std;
- int main()
- {
- using namespace std;
- int chest = 42;
- int waist = 42;
- int inseam = 42;
- cout << "Monsieur cuts a striking figure!" << endl;
- cout << "chest = " << chest << " (decimal for 42)" << endl;
- cout << hex; // manipulator for changing number base
- cout << "waist = " << waist << " (hexadecimal for 42)" << endl;
- cout << oct; // manipulator for changing number base
- cout << "inseam = " << inseam << " (octal for 42)" << endl;
- // cin.get();
- return 0;
- }
|