fork download
  1. // To display hexadecimal integer literals and
  2. // decimal integer literals.
  3. //
  4. #include <iostream>
  5. using namespace std;
  6. int main()
  7. {
  8. // cout outputs integers as decimal integers:
  9. cout << "Value of 0xFF = " << 0xFF << " decimal"
  10. << endl; // Output: 255 decimal
  11. // The manipulator hexchanges output to hexadecimal
  12. // format (decchanges to decimal format):
  13. cout << "Value of 27 = " << hex << 27 <<" hexadecimal"
  14. << endl; // Output: 1b hexadecimal
  15. return 0;
  16. }
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
Value of 0xFF = 255 decimal
Value of 27 = 1b hexadecimal