Question: Trivia Game Implement the Question class that will be the base for a Trivia Game. The interface for this class is provided in question.h .

Trivia Game

Implement the Question class that will be the base for a Trivia Game. The interface for this class is provided in question.h . Implement all member functions in question.cpp. Please note that it is important that you do not change question.h .

Create a program (in main.cpp, which you will turn in) that implements the trivia game. The program should create an array of 10 Question objects, one for each trivia question. Make up your own trivia questions on the subject or subjects of your choice.

Your game should present the user with the 10 questions in a way that you like. How you will present the questions and in which order is up to you, but make sure to follow these requirements:

the interface is friendly, not cluttered, with clear directions (ask someone to play your game to see if it is easy to follow)

the user is informed whether the answer they enter is right or wrong. If wrong, let them know what the correct answer is.

Question.h is

//

// Question.h

// Trivia

//

#ifndef Question_h

#define Question_h

#include

using namespace std;

class Question {

private:

string question;

string answer1;

string answer2;

string answer3;

string answer4;

unsigned short int correctAnswer;

public:

Question(string question, string ans1, string ans2, string ans3, string ans4, unsigned short int correct);

void setQuestion(string question);

void setAnswer1(string ans);

void setAnswer2(string ans);

void setAnswer3(string ans);

void setAnswer4(string ans);

void setCorrect(unsigned short int correct);

string getQuestion();

string getAnswer1();

string getAnswer2();

string getAnswer3();

string getAnswer4();

unsigned short int getCorrectAnswer();

};

#endif /* Question_hpp */

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!