Create a program called Quizzy that allows the user to take multiple-choice quizzes. The quiz questions and answers are given in text files.
The quizlist.txt file specifies the name of each quiz (one name per line). Ex:
History
Movies
Comp Sci
There can be any number of quizzes in quizlist.txt.
Each quiz's text file is named after the quiz by appending a ".txt" file extension. Ex: The History quiz's questions are in History.txt. The quiz file contains a question (on a single line) followed by exactly 4 possible answers (called options). The correct answer has a ^ at the beginning. The file may contain any number of questions.
Ex History.txt file:
In what year was the Declaration of Independence signed?
^1776
1670
1782
1882
Who was the second president of the United States of America?
Abraham Lincoln
George Washington
Thomas Jefferson
^John Adams
What city was destroyed in 79 AD by a volcano on Mount Vesuvius?
Rome
Florence
^Pompeii
Venice
Create a project with the following files:
The Quiz class should contain the following:
Example of TakeQuiz() output that includes user's input:
History Quiz
1. In what year was the Declaration of Independence signed?
A. 1776
B. 1670
C. 1782
D. 1882
Your answer?
a
Correct!
2. Who was the second president of the United States of America?
A. Abraham Lincoln
B. George Washington
C. Thomas Jefferson
D. John Adams
Your answer?
c
Wrong. The correct answer is D.
3. What city was destroyed in 79 AD by a volcano on Mount Vesuvius?
A. Rome
B. Florence
C. Pompeii
D. Venice
Your answer?
c
Correct!
You answered 2 of 3 questions correct!
The Question class should contain the following:
The main.cpp file should read the quiz names from quizlist.txt, display the quiz names, and prompt the user to enter a quiz to take.
Example program output with user input displayed:
Welcome to Quizzy
1. History
2. Movies
3. Comp Sci
Which quiz would you like to take (0 to quit)?
2
Movies Quiz
1. What was the first feature-length animated movie ever released?
A. Snow White and the Seven Dwarfs
B. Pinocchio
C. Fantasia
D. Dumbo
Your answer?
a
Correct!
2. What does Neo do to discover the truth of The Matrix?
A. Gets hit by lightning
B. Swallows red pill
C. Injected with truth serum
D. Jumps off a building
Your answer?
d
Wrong. The correct answer is B.
3. For what movie did Steven Spielberg win his first Oscar for Best Director?
A. Ready Player One
B. Schindler's List
C. Indiana Jones
D. Jurassic Park
Your answer?
b
Correct!
4. What song plays over the opening credits of Guardians of the Galaxy?
A. "Hooked on a Feeling" by Blue Swede
B. "Go All the Way" by Raspberries
C. "Cherry Bomb" by The Runaways
D. "Come and Get Your Love" by Redbone
Your answer?
a
Wrong. The correct answer is D.
You answered 2 of 4 questions correct!
1. History
2. Movies
3. Comp Sci
Which quiz would you like to take (0 to quit)?
4
1. History
2. Movies
3. Comp Sci
Which quiz would you like to take (0 to quit)?
0
Goodbye!