My english is not good,so i don't know how to say,is it use "withhold"?i mean
a=12.33342,b=1.3321
if i want to withhold the 2 two digits of the decimal fraction
i wanna output a=12.33,b=1.33
so is there any function in cout can control it?just like cout.precision(),which can control the decimal fraction's valid digits?
how to withhold the digit of decimal fraction?
Moderator: Board moderators
how to withhold the digit of decimal fraction?
"Learning without thought is useless;thought without learning is dangerous."
"Hold what you really know and tell what you do not know -this will lead to knowledge."-Confucius
"Hold what you really know and tell what you do not know -this will lead to knowledge."-Confucius
-
- Guru
- Posts: 834
- Joined: Wed May 29, 2002 4:11 pm
- Location: Wroclaw, Poland
- Contact:
if i use the procision(3) function
a=12.33342,b=1.3321
the output will be
12.3 1.33
but what i need is
12.333 1.332
which function i shall use?
a=12.33342,b=1.3321
the output will be
12.3 1.33
but what i need is
12.333 1.332
which function i shall use?
"Learning without thought is useless;thought without learning is dangerous."
"Hold what you really know and tell what you do not know -this will lead to knowledge."-Confucius
"Hold what you really know and tell what you do not know -this will lead to knowledge."-Confucius
-
- Guru
- Posts: 584
- Joined: Thu Jun 19, 2003 3:48 am
- Location: Sanok, Poland
- Contact: