Output Hexadecimal default : Hexadecimal « Data Type « C++






Output Hexadecimal default

  
#include <iomanip>
#include <iostream>

using namespace std;

int main( )
{
   cout << "Enter a hexadecimal number: ";
   int num;
   cin >> hex >> num;

   cout << "\nDecimal: " << num
        << "\nHexadecimal default: " << hex << num;

}
  
    
  








Related examples in the same category

1.Display hexadecimal integer literals and decimal integer literals.
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