hi everyone
I would like to roungd 2.34567 to 2.34, can I have something like that in C++.
if you see this
Code:
#include <stdio.h>
#include <math.h>
int main ()
{
printf ("floor of 2.3 is %.1lf\n", floor (2.3) );
printf ("floor of 3.8 is %.1lf\n", floor (3.8) );
printf ("floor of -2.3 is %.1lf\n", floor (-2.3) );
printf ("floor of -3.8 is %.1lf\n", floor (-3.8) );
return 0;
}
the output is 2.0
3.0
-2.3
-3.8
I do want something like this, I would like to reduce the numbers after the point.
so this number 2.456633 would lke it to be 2.46
What can I use, what math operator.
thank you inadvance