Display hexadecimal integer literals and decimal integer literals. : Hexadecimal « Data Type « C++






Display hexadecimal integer literals and decimal integer literals.

 

#include <iostream>
using namespace std;
int main()
{
  cout << "Value of 0xFF = " << 0xFF << " decimal" << endl;                 
  cout << "Value of 27 = " << hex << 27 <<" hexadecimal" << endl;              
  return 0;
} 


           
         
  








Related examples in the same category

1.Output Hexadecimal default
2.Output Hexadecimal without base
3.Output Hexadecimal with uppercase base
4.Output Hexadecimal with lowercase base
5.Output digits in hex and octOutput digits in hex and oct
6.gain access to cout, cin, and hexgain access to cout, cin, and hex
7.Reads integral decimal values and generates octal, decimal, and hexadecimal output
8.Enter hexadecimal digits and a floating-point numberEnter hexadecimal digits and a floating-point number
9.Set cout to output hex number
10.Display hexadecimal value as decimal value