How would I split an inputted string such as "one two three four five" into an array. currentyly I have this:
const int SIZE = 5;
string digit[SIZE];
cout << "Enter the five here:";
for(int i = 0; i < SIZE; i++)
{
cout << i+1 << ")";
getline(cin, digit[i]);
}
but as it stands, the user has to hit enter every time. How do I get it so when I call digit[1] for the example input above, I get two. Hopefully that makes sense, I would imagine there is some function to do this for you, but if there is really elementary way of doing it, that would probably benefit me best, I'm still learning. thx