floating point to string
1.how do you convert flaoting pointing number to string without using sprintf() function
2. suppose there is one floating point number 1000.0001 how would you count number of zero's in the number without converting number into string.
thanx in advance.
eagerly expecting ur ans
Some compilers defines a non-standard atof() function. Does yours?
Because you're dealing with digital data, you can never be sure if your value is 1000.0001 or 1000.0001000001 or not. All you can do is display the appropriate number of decimals.
I have used one function which gives you integer part and decimal part. But I dont remember function name. You can use that function to split integer and fractional part. Then the job becomes so easy to convert int to string. The above is the answer for first question.
For second question again use integer and fractional part to determine the No. of zero's. In fractional part mulitply the number with 10 till you get a number greater than 0 and apply the logic that you have applied for integer part.