Output digits in hex and oct : Hexadecimal « Data Type « C++






Output digits in hex and oct

Output digits in hex and oct
 
#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
  cout << hex << 100 << endl;
  cout << oct << 10 << endl;

  cout << setfill('X') << setw(10);
  cout << 100 << " hi " << endl;

  return 0;
}



           
         
  








Related examples in the same category

1.Display hexadecimal integer literals and decimal integer literals.
2.Output Hexadecimal default
3.Output Hexadecimal without base
4.Output Hexadecimal with uppercase base
5.Output Hexadecimal with lowercase base
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