You can use the std::stringstream class along with the getline() function to tokenize a string based on a delimiter.
Here's an example:
#include <iostream>
#include <string>
#include <sstream>
int main() {
std::string userInput;
std::cout << "Enter a string: ";
std::getline(std::cin, userInput);
std::stringstream ss(userInput);
std::string token;
while (std::getline(ss, token, ',')) { // Assuming comma (',') as the delimiter
std::cout << "Token: " << token << std::endl;
}
return 0;
}