I have a string like -1,1.51,-2.525,3.456... etc values.
I need to convert this each value(string) to float and add all the values to produce result.
Again I need to convert resulted float to string with two number after decimal point.
Example : -1+1.51-2.525+3.456 = 1.44.
Thanks in advance.
Look up the
strtof()function, it’s perfect for doing things like this. Note that it parses a floating-point number, and also returns a pointer to the first character not considered part of the number.