Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

cout.setf(ios::fixed)

Posted on 1997-03-02
1
1,216 Views
Last Modified: 2012-08-13
What means the next line

   cout setf(ios::fixed)
0
Comment
Question by:rene zinken
1 Comment
 

Accepted Solution

by:
radagast earned 50 total points
ID: 1162269
This chooses the "fixed" format for printing floating point numbers. The effect is that floating pointer numbers will be
printed in the format xxxx.yyy where the number of digits after
the point is given by 'precision()' and the total length of the output is given by 'width()'.
However, you should modify the statement to become
  cout.setf(ios::fixed, ios::floatfield);
to make sure that other format flags are properly cleared.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

789 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