View Full Version: setting amount of decimal places

C++ Learning Community > C++ Help > setting amount of decimal places


Title: setting amount of decimal places


666kennedy - February 8, 2007 02:40 PM (GMT)
firstly thank you to everyone that has helped me so far, and im sorry to pester people with my basic questions...

secondly, my problem,

how do you set the amount of decimal places. i have found something that mentions the stream manipulator setprecision(2) to round the output to 2 decimal places.

it also mentions this

setiosflags(ios::fixes)

and i know i have to include <iomanip.h> at the start.

thanks again!

myork - February 8, 2007 03:01 PM (GMT)
QUOTE (666kennedy @ Feb 8 2007, 09:40 AM)
firstly thank you to everyone that has helped me so far, and im sorry to pester people with my basic questions...

secondly, my problem,

how do you set the amount of decimal places. i have found something that mentions the stream manipulator setprecision(2) to round the output to 2 decimal places.

it also mentions this

setiosflags(ios::fixes)

and i know i have to include <iomanip.h> at the start.

thanks again!

So based on what you have read.

How do you think you use setprecision()?


Zaqufant - February 8, 2007 08:46 PM (GMT)
QUOTE
firstly thank you to everyone that has helped me so far, and im sorry to pester people with my basic questions...


Nah. You arn't pestering us. You weren't here when we got crackles attacked. you don't know what pester means until you learn about the crackles attack. And we live to answer questions of people. As long as your polite to us and don't demand us to do stuff, we'll be fine.

666kennedy - February 8, 2007 09:45 PM (GMT)
thanks, its not like im trying to get you to write the programs for my uni module, i am working ahead, (bit of a geek i know) and i just get stuck at bits that arent very well described... but thankyou very much. and i sorted out the problem with the decimal points. so thanks for everyone thats helped, and this definately wont be the last post from me!

Zaqufant - February 8, 2007 10:33 PM (GMT)
GREAT! the more the marrier. And we're always glad to help. Remember that.




Hosted for free by InvisionFree