Previously writtenProgramYou need to convert the string you entered into a floating point number. My solution is to write
The function declaration is similar to: Float cstring2float (cstring Str,
In fact, the conversion between strings and numbers C has provided a large number of functions that we can fully utilize
These ready-made functions improve program robustness. Common conversion functions include:
Atof char * to float
Atoi char * to int
Atol char * to long
In fact, this type of conversion function is very many. Because I don't feel good about classification, I only list the preceding functions.
To view other conversion functions, enter data conversion routines in msdn,
You can find other available conversion functions in this topic. For more information, see msdn.
_ Atoi64 strtol strtodd _ wtoi _ wtoi64 _ wtol wcstol wcstod _ tcstol _ tcstod
Strtoint strtointex strtoint64ex
_ ITOA _ i64toa _ ui64toa _ ltoa _ ultoa
_ Itow _ i64tow _ ui64tow _ ltow _ ultow
If you are not using vc6, but vs2003 or later, you can use char * for conversion *,
What if you are using Unicode encoding? refer to conversion between Unicode and MBCS.
Http://blog.csdn.net/zhuce0001/article/details/9140613