I'm looking to separate a string containing numbers separated by one space, ie: "1 14 22 6 7". After splitting them up I wanted to store them some how so I could manipulate each sub-string individually and run through them with a loop of some kind, probably for. I've tried using istringstream code snippets from online but don't understand the code enough to store them in something like a string array. I've also tried using fixed character counts but that doesn't help because these values will be changing. Thanks in advance.
If they are numbers, why store them as strings? You probably want something like this:
1 2 3 4 5 6 7 8
std::vector<int> numbers;
std::istringstream iss {"1 14 22 6 7"};
int x;
while(iss >> x) //it is good practice to loop on the input operation
{
numbers.push_back(x);
}