I don't see any problem other than poorly formatted code. See this -- proper formatting usually helps find errors.
Also, in case #3 you should add a break. If you add more CASEs and forget, you've got another error.
WaltP
Posting Sage w/ dash of thyme
10,505 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
Well OP, Your code do have a problem, see while using "Do while" loop you should increment the value of the integer inside the loop
So currently the value for (x) is never getting incremented. Thus the value never reaches 4, so it becomes infinite loop.
Not true. What does cin >> x; do tox immediately after the do ?
WaltP
Posting Sage w/ dash of thyme
10,505 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944