30.08.2014, 21:20
I'm trying to code a "strfloat" function which will transform a floating point number in a string (without having to use format of course).
Though, I'm blocked here :
Though, I'm blocked here :
pawn Код:
strfloat(Float:nbr, dest[22])
{
new rtn = floatround(nbr);
new pos;
do
{
dest[pos++] = '0' + rtn % 10;
rtn /= 10;
}
while(rtn);
new i;
for(i = 1; i < 1000000000; i*=10)
{
if(rtn % (i)) continue;
break;
}
// how to check how much zeros has "i" and then reassigning the checked value to "i" ?
new str[22];
strcat(string, dest[i+1]);
dest[i+1] = '.';
dest[i+2] = str;
}