Simple but confused question

RUn this program...

#include <iostream>
#include <iostream>
using namespace std;
main()
{
   cout.setf(ios::hex);
   cout.setf(ios::showbase);
   cout << 100 ;              
   return 0;
}

Why not displaying 0X64 ? (Which is the expected value)
prainAsked:
Who is Participating?
 
Karl Heinz KremerCommented:
For  dec, oct and hex you need to set the second parameter of setf to basefield:
   cout.setf(ios::hex, ios::basefield);
0
 
nonubikCommented:
try putting
cout.unsetf(ios::dec);
before all.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.