How can I read in this line of input?

I need to read in: add 101 1011

I need to save add to a string and the two numbers to ints.

The only way I can think to do this is saving the entire input to a string and then going through the string and looking for spaces then when the spaces are found save the add to a new string and the two numbers to ints. Bur I don't know if that would even work.

What is a good way to read this one line of input and saving add to a string and the two numbers to ints?

Thanks
1
2
3
std::string ch;
float num1, num2;
std::cin >> ch >> num1 >> num2;

It's as easy as that.
Topic archived. No new replies allowed.