Edit boxes and integers.
I've been playing around with C++ for a few weeks and decided to jump into windows programming. I have created a simple program that calculates sales tax but have run into an issue.
The program uses edit boxes in which the user inputs values for the starting price and their local tax rate and the results are outputed into a total tax box and a total prce box (using SetDlgItemInt). The edit boxes seem to ignore the decimal points on the tax rate box. The total tax box always returns 0, but works fine if I use a number >0.
I've looked around on these forums but I'm having a hard time figuring out what I need to do. I found references to a sprintf and atof , but the atof function appears to be for strings to floats/doubles. Something that would take a float and make it into a string might help.
I'll post the code if neccesary, and I'm using Dev-cpp 220.127.116.11.
Thanks in advance
Found this in less than 3 minutes of googling: http://www.cplusplus.com/ref/cstdlib/fcvt.html It says "Convert floating point value to string." as the description of what the function does, that's what you want right?
sprintf() is a more portable way to convert a float to a string.
float f = 1.5f;
printf("the value of f is %s\n",buff);
Both ways appear to work, but I like the sprintf way better!