c++: setting output format to hex??

Maurizio Loreti loreti@pd.infn.it
Sat Dec 4 03:17:00 GMT 1999


Guy Van Den Bergh <guy.vandenbergh2@advalvas.be> writes:

> Hi there,
> I want to know how I can set the output format (for cout output stream)
> for integers to hex or oct.

#include <iostream>

using namespace std;

int main() {
  cout << hex << 42 << endl;
}

> Thanx!

You are strongly encouraged to buy some FM and to RTFM.

-- 
Maurizio Loreti                         http://www.pd.infn.it/~loreti/mlo.html
Univ. of Padova, Dept. of Physics - Padova, Italy            loreti@pd.infn.it


More information about the Gcc-help mailing list