Question: Can someone please help me write this in C++ Thank you in advance! For this lab you will create a file with information that will
Can someone please help me write this in C++ Thank you in advance!
For this lab you will create a file with information that will feed a guessing or a trivia game.
For a guessing game, you will build a file with fragments of questions and matching answers. For example:
animal dog
color red
food chocolate
country Greece
Your program will read each pair of words from the file, then use the first word to make a question and use the second word as the correct answer. For example, your program could print something like this on the screen:
I'm thinking of an animal. Guess what animal it is...
Then match the user's answer with dog. If the user guesses the answer that is recorded in the file (dog), print a message saying the answer was right, otherwise, say the answer was wrong. Keep track of how many right and wrong answers.
Create a file with 10-15 pairs.
For a trivia game, I suggest you create a file with one question per line, then the answer on the next line. For example:
In what year did World War II end?
1945
What is 2 raised to the 10th power?
1024
For each question, if the user gives the answer that is recorded in the file as the correct answer, print a message saying the answer was right, otherwise, say the answer was wrong. Keep track of how many right and wrong answers.
Create 10-15 pairs of questions/answers.
At the end of the program, print how many questions were answered correctly and incorrectly.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
