I have to write a code where I tell the user to enter a sentence that has at least three commas. Then i have to print out each of the three words that appear after each of the first three commas. I am so lost and it is just introductory programming. Can anyone help?

I have to write a code where I tell the user to enter a sentence that has at least three commas. Then i have to print out each of the three words that appear after each of the first three commas. I am so lost and it is just introductory programming. Can anyone help?

1) Prompt the user for input.
2) Accept input and store it in a string.
3) Parse input string to make sure it has at least three commas.
4) Give error message if it does not and end the program.
5) Parse input string and extract the words after the commas.
6) Display the words.

The find function may come in handy, as will the getline function.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.