0

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?

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by VernonDozier
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.