I need a working String -> Float converter for one of the projects I have to do for my comp sci course.
Woah… first time I’m ever on the asking end for computer help.
I need a working String -> Float converter for one of the projects I have to do for my comp sci course.
Woah… first time I’m ever on the asking end for computer help.
happens to the best of us…
if i knew anything about this kind of computer programming, i’d be glad to help you, but, i don’t…
#include <sstream>
string s = “5 1.2”;
int myint;
float myfloat;
istringstream in(s);
in >> myint >> myfloat;
Basically stringstreams let you read and write to strings just like reading and writing to any other stream.