Newbie question but I have a string that gets 3 numbers, such as:
144.3 432.3 532.3
Now I define 3 floats with
float x;
float y;
float z;
How can I put all the values inside of them? Where,
x = 144.3;
y = 432.3;
z = 532.3;
Newbie question but I have a string that gets 3 numbers, such as:
144.3 432.3 532.3
Now I define 3 floats with
float x;
float y;
float z;
How can I put all the values inside of them? Where,
x = 144.3;
y = 432.3;
z = 532.3;
You can use std::stringstream
:
std::stringstream ss("144.3 432.3 532.3");
float x, y, z;
ss >> x >> y >> z;