Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Goals: The goals for this program are to experiment with functions,more array of

ID: 3614492 • Letter: G

Question

Goals:

The goals for this program are to experiment with functions,more array of characters, and external data files. You should alsostrive to use a small main function and break tasks up intofunctions.

Program Assignment:

With this program we will be developing a trivia game for up to4 players. You can make this program simple or have fun with it andstretch yourself!

You will need a set of questions and possible right answers withpoints attached to each answer. Players will be given a chancebased on the questions to supply an answer. The job of your programwill be to determine whether their answers correctly match one ofthe possible right answers; your program would keep track of thescore for each player. Whoever has the most points at the end ofthe game wins!

You will need an external data file of the questions, series ofanswers and the points available for each answer. You get to makethese up. Name your file: “TriviaQuestions.dat”. Youcan create this file using a standard text editor. It should be ofthe format:

           Question: Answer#1: Points: Answer #2: Points

Allow the users to see their scores as the program continues.Allow them to end early as well (they shouldn’t have tocontrol-C to get out of the program!!).

Important things to keep in mind

1.      Write at leastfour functions WITH arguments for thisassignment.

2.      Echo your input and ask theuser if it is correct (have a confirmation loop again!)

3.      Allow the user to enter in thename of the external data file.

4.      Hint: In this assignment, eachquestion may have multiple words as part of the question.Therefore, you now SHOULD read using the 3 argument version ofget.

5.      Watch out. When using the 3argument version of get you need to make sure to remove thedelimiter or newline. Therefore, anytime you read (even aconfirmation message), make sure to eat the newline!

6.      Make sure to have a delimiterwritten between each item in the file – like a newline. Thiswill be important when you read the information back from thefile.

7.      When working with files, youmust use the following order:

                       Perform a read

                       If this read was successful, (i.e., if you have not reached end offile)

                         Processwhat was read

Explanation / Answer

please rate - thanks hopefully this will get you started #include #include #include using namespace std; #define MAX 20 struct question { char quest[50]; char ans1[20]; char ans2[20]; int pts1; int pts2; } ques[MAX]; int getNumberOfPlayers(); void readDisplayQuestions(); void intro(); bool menu(int); int askquestion(int&,int); void printscores(int[],int); int main() {bool gameover=false,play; int number,score[4]={0,0,0,0},player=0,upto=0; intro(); number = getNumberOfPlayers(); cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote