Question: From Starting Out with C++ (8th Edition) programming challenge chapter 13 number 19 PC Program 2: In this programming challenge you will create a simple

From Starting Out with C++ (8th Edition) programming challenge chapter 13 number 19 PC

Program 2:

In this programming challenge you will create a simple trivia game for two players. The program will work like this:

Starting with player 1, each player gets a turn at answering five trivia questions. (There are a total of 10 questions.) When a question is displayed, four possible answers are also displayed. Only one of the answers is correct, and if the player selects the correct answer he or she earns a point.

After answers have been selected for all of the questions, the program displays the number of points earned by each player and declares the player with the highest number of points the winner.

In this program you will design a Question class to hold the data for a trivia question. The Question class should have member variables for the following data:

A trivia question

Possible answer #1

Possible answer #2

Possible answer #3

Possible answer #4

The number of the correct answer (1, 2, 3, or 4)

The Question class should have appropriate constructor(s), accessor, and mutator functions.

The program should create an array of 10 Question objects, one for each trivia ques- tion. Make up your own trivia questions on the subject or subjects of your choice for the objects.

The program should have a menu for each question with the possible answers as shown here:

Question Bank for XYZ Subject --------------------------------------------------------------

Question for PLAYER 1: ---------------------- (1) What famous document begins: "When in the course of human events..."? ANSWERS: 1. The Gettysburg Address 2. The US Declaration of Independence 3. The Magna Carta 4. The US Bill of Rights Enter the correct answer: 1 Sorry, that's incorrect. The correct answer is 2. The US Declaration of Independence

Question for PLAYER 2: ---------------------- (2) Who said "A billion dollars isn't worth what it used to be"? ANSWERS: 1. J. Paul Getty 2. Bill Gates 3. Warren Buffet 4. Henry Ford Enter the correct answer: 1 Correct!

Your program does not need to be a replica, but it should be representative of the output that is shown here. Use a loop to display the questions. You may hardcode the question/answer data, but try to read it from a file.

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!