double format
Hi!
I have
double b = 0.1;
is there a function, which adds me an 0 to b?
b = 0.10
I know it sounds silly. But i have an simple math programm (learning simple math stuff with computer). And I need an output with two decimal figure.
I save two numbers in an stringstream and then return the string:
stream << a << " " << b << " | ";
Christian
I''m going to get chewed on for this, but I don''t care.
#include <stdio.h>
(...)
printf("%5.2f", b);
#include <stdio.h>
(...)
printf("%5.2f", b);
quote:Original post by RuneLancerIndeed: the header should be <cstdio>, and you''ll want to call ios::sync_with_stdio(); somewhere.
I''m going to get chewed on for this...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement