Hi Daniweb!
I couldnt find my problem anywhere else on this forum, so I decided to make my own thread...
My problem: I'm trying to make a function to decide how many decimals a 'double' has.
My code (slightly edited, here's the base of it):
// int m = 0;
int decimal ( double total) {
double dec = total - (int) total;
if (dec)
{
m++
dec *=10;
decimal (dec);
}
else
return m;
}
The results: the funtion works, if there're no decimals. Else it returns my max, which is 5.
ANY help would be very aprreciated!
Thanks in advance