Question: 3 . Write a C + + program that does the following: a . Create a C + + file with the name problem 3

3. Write a C++ program that does the following: a. Create a C++ file with the name problem3.cpp. b. Prompt the user for a positive integer, which represents the number of simulated die rolls. Print "Not playing games." and terminate the program if the user enters an invalid integer. c. Use a loop to simulate n die rolls, where for each die roll, print the roll number and the simulated die roll value. d. After the last die roll, print the total count of ones rolled. Sample run of the program: Enter the number of die rolls: 5 Roll 1: 2 Roll 2: 3 Roll 3: 6 Roll 4: 1 Roll 5: 2 Total number of ones rolled: 1.

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 Programming Questions!