Hi,
Want to format and truncate/round my number at the same time in the program:
Here I want the + sign shown:
1 2 3 4
|
float n = 3.8;
printf("%+f", n);
=+3.800000
|
I get success independently with prinftf("%+f","n") and setprecision(x)
I just want the answer to 2 decimal points for which I use
setprecision(2) and the sign "+" is not shown. My goal is to show e.g:
+5.0 as just that
Last edited on