I'm wondering what sort of algorithm could be used to take something like "4.72" into a float data type, equal to
float x = 4.72;
scanf, operator>> for istreams, and strtof would be the obvious choices.
scanf
operator>>
strtof
There is also atof, but, like atoi, it lacks a way to tell you there was an error in the input, so it's generally best to avoid both.
atof
atoi
1.4m articles
1.4m replys
5 comments
57.0k users