Solved

cout.setf(ios::fixed)

Posted on 1997-03-02
1
1,188 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
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 goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

758 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now