hexoct1.cpp 513 B

12345678910111213141516
  1. // hexoct1.cpp -- shows hex and octal literals
  2. #include <iostream>
  3. int main()
  4. {
  5. using namespace std;
  6. int chest = 42; // decimal integer literal
  7. int waist = 0x42; // hexadecimal integer literal
  8. int inseam = 042; // octal integer literal
  9. cout << "Monsieur cuts a striking figure!\n";
  10. cout << "chest = " << chest << " (42 in decimal)\n";
  11. cout << "waist = " << waist << " (0x42 in hex)\n";
  12. cout << "inseam = " << inseam << " (042 in octal)\n";
  13. // cin.get();
  14. return 0;
  15. }