My program receives input from the user, in this exact form: string, integer. An example would be: Brady, 12. I need to split the string at the comma, and store the first part into a vector of strings, and the 2nd part into a vector of integers. How do I go about this? (Sorry, I'm very new to programming)
This is what my code currently looks like:
while(true) {
cout << "Enter a data point (-1 to stop input): " << endl;
getline(cin, dataPoint);
if (dataPoint == "-1") { //Ends Program
break;
}
if (dataPoint.find(",") == std::string::npos) {
cout << "Error: No comma in string." <<endl;
}
}