question reg diff between: fixed, setprecision, and showpoint

KAMAZON

Golden Member
Apr 4, 2001
1,300
0
76
www.alirazeghi.com
Hello I am very new to C++ and I am very confused regarding the differences between these functions. I have read different things online and tried different test programs but I am hitting a wall in trying to figure out the exact difference. Wouldn't fixed and showpoint do the same thing? Does setprecision take into account the entire number and setprecision only affect the decimal?

For example such as a double initilized as 422.53432123

would then fixed(5) be 422.53
where showpoint(5) would be 422.53432

Thanks in advance.
 

aCynic2

Senior member
Apr 28, 2007
710
0
0
So far, from what I'm reading:

setprecision caps the number of digits to the number you specify. That mean the left of decimal + the right of decimal.
fixed affects only what is to the right of the decimal point.
showpoint forces a decimal display on the output, even if what is to the right of the decimal point is 0.