Solved

Simple but confused question

Posted on 2004-04-16
2
161 Views
Last Modified: 2010-04-01
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)
0
Comment
Question by:prain
2 Comments
 
LVL 44

Accepted Solution

by:
Karl Heinz Kremer earned 25 total points
ID: 10842569
For  dec, oct and hex you need to set the second parameter of setf to basefield:
   cout.setf(ios::hex, ios::basefield);
0
 
LVL 16

Assisted Solution

by:nonubik
nonubik earned 25 total points
ID: 10842580
try putting
cout.unsetf(ios::dec);
before all.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question