hexoct2.cpp 604 B

12345678910111213141516171819
  1. // hexoct2.cpp -- display values in hex and octal
  2. #include <iostream>
  3. using namespace std;
  4. int main()
  5. {
  6. using namespace std;
  7. int chest = 42;
  8. int waist = 42;
  9. int inseam = 42;
  10. cout << "Monsieur cuts a striking figure!" << endl;
  11. cout << "chest = " << chest << " (decimal for 42)" << endl;
  12. cout << hex; // manipulator for changing number base
  13. cout << "waist = " << waist << " (hexadecimal for 42)" << endl;
  14. cout << oct; // manipulator for changing number base
  15. cout << "inseam = " << inseam << " (octal for 42)" << endl;
  16. // cin.get();
  17. return 0;
  18. }