I/O problem

Write here if you have problems with your C++ source code

Moderator: Board moderators

Post Reply
Zhao Le
Learning poster
Posts: 80
Joined: Mon May 05, 2003 4:09 am
Location: Shanghai,China

I/O problem

Post by Zhao Le »

For each line of input produce one line of output containing a floating point number with ten digits after the decimal point.
such as this kind of problem how should I use the I/O fuction?

In C I can use the printf("%.10f",...);

but I cannot find any function in C++.

I have tried cout.precision(10);

but this not mean that.

Hope anyone can help.
AC makes me feels good,
But WA makes me thinks hard.
Krzysztof Duleba
Guru
Posts: 584
Joined: Thu Jun 19, 2003 3:48 am
Location: Sanok, Poland
Contact:

Post by Krzysztof Duleba »

Try something like

Code: Select all

cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(10); 
Zero will be printed as 0.0000000000. Is this what you want?
Zhao Le
Learning poster
Posts: 80
Joined: Mon May 05, 2003 4:09 am
Location: Shanghai,China

Thanks

Post by Zhao Le »

Thanks you did solve a big problem for me.
AC makes me feels good,
But WA makes me thinks hard.
Post Reply

Return to “C++”