[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: cout query

You'll have to use manipulators for that,

A very basic example will be


int main()
     float f(35.67);
     int a(34);

     cout << f     // default float
     << hex       // now start printing in hex
     << a << endl ;

Here "hex" is a manipulator. And any number after this is printed in
hexadecimal. There are a lot of things you can do with manipulators and
there are a lot of them....Check out Lippman.
BTW: endl, flush, etc. are also manipulators


How do I use cout (c++,  on unix) for formatted output, like printf in C.

The thing is I want to output the hexadecimal representations of
characters..........in c++ using cout.............

The LIP mailing list archives are available at: