iostream hierarchy
dec / hex / oct
  cplusplus.com  
stream manipulators
ios_base& dec ( ios_base& str );
ios_base& hex ( ios_base& str );
ios_base& oct ( ios_base& str );

Selects a base format flag
  dec sets the base format flag to represent integer values as decimal numbers.
  hex sets the base format flag to represent integer values as hexadecimal numbers.
  oct sets the base format flag to represent integer values as octal numbers.

Parameters.

str
Stream object where to apply. This is a manipulator parameter.

Return Value.
  A reference to the stream object.

Example.

// modify basefield
#include <iostream>
using namespace std;

int main () {
  int n;
  n=70;
  cout << dec << n << endl;
  cout << hex << n << endl;
  cout << oct << n << endl;
  return 0;
}
The execution of this example shall display:
  70
  46
  106

See also.
  flags, setf, unsetf
  ios_base class


© The C++ Resources Network, 2001