I\'m writing a program that prompts the user for:
First part is fine, I create a dynamica
You can use getline() method as below:
#include
#include
#include
int main()
{
std::string input_str;
std::vector vect;
std::getline( std::cin, input_str );
std::stringstream ss(str);
int i;
while (ss >> i)
{
vect.push_back(i);
if (ss.peek() == ',')
ss.ignore();
}
}
The code is taken and processed from this answer.