-
Quick decimal question
i'm using tomething like this
sprintf(buffer,"Number: %.5f",int);
i want it to always be the right number so if i had 5.23 i don't want it showing up as 5.23000 or i fi had a number like 5.1234567 i want all the numbers to show, is there something i can do to hav the decimal point always set itself to the proper number of places?
-
I am pretty sure that the most decimal places you can achieve is 5 places by using a double or float;
-
How many decimal places does a recuring number have? For example 1/3.
Anyway, lookup the %g modifier, that may do what you want.
-
Are you using printf() in a C++ program? In C++, you could format cout using setf() and setprecision().
Kuphryn