Question: Write a C++ program that lets you enter as many sentences as you want (assume less than 100). Keep allowing the user to enter sentences

Write a C++ program that lets you enter as many sentences as you want (assume less than 100). Keep allowing the user to enter sentences until they type a single line with the word exit (no quotes). At this point, you should display everything that they had written, except removing an parts that are comments. Use the normal C++ rules for commenting, where // comments out only the rest of the current line and /* will continue commenting until a */ is reached.

If a comment comments out the full line (no spaces or anything outside of the comment), do not display anything for this line. In other words, fully removed lines should not become blank after removing comments, just show the next line that is non-blank. You should also treat blank lines in the input the same way, just simply ignore them and do not show them in the output. For this part, you may assume there is at most one comment indication per line. In other words, you will not have a sentence like: I /* like */ apples ... you may also assume that every /* will have a closing */ and that exit will not be typed in the middle of a comment. For example, we will not test for something like this (no tabs/spaces in input):

/* start comment exit did I catch you? */

Example 1 (user input is Bold):

hi there

you are my friend lets have fun // just kidding, you are a total jerkface

lets /* play

a game

called */ guess

exit

hi there

you are my friend

lets have fun

lets guess

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!