Hello
I use sprintf_s() to convert numbers to strings however I have a problem with decimal places. What do I do if I dont know in advance how many decimal places will a number have and I want to show decimal places only if there are any.
2045 / 756 I have no idea how many decimal places will the answer have. What do I do to find out?
If I use only
That will end up with two decimal places even if they are both zeroes... In this case it will work but what if I had 9 / 3...Code:ValueX = 2045 / 756; sprintf_s(lpText, "x = %.*f", 2, ValueX);
Thank you