Write a program that will deliver a multiple choice quiz. solved

Write a program that will deliver a multiple choice quiz. solved

Write a program that will deliver a multiple choice quiz.  
The program should read questions from the file Questions.txt which contains 8 questions.
The program will prompt and get a response from the console keyboard.
The program will validate that the keyboard entry is A, B, C or D. 
The program will re-prompt until a valid entry is given
The program will then read the answer value for the question from Answers.txt
The response will be written to the file Results.txt
after all questions are read, the program will write the number of incorrect responses to the 
Results.txt file.
A counter variable will be incremented when a wrong answer is detected
Use the following keyboard responses to test your program C, A, C, D, B, C, A, B

The expected contents of the Results.txt file should be

C

A

C

D

B

C

A

B

3 wrong answers

Questions.txt

1 The chemical reference for water is: A) H0 B) H2O C) CO2 D) W2C
2 Which ocean boarders New York: A) Pacific B) Baltic C) Atlantic D) Mediterranean
3 Which bridge is not in California: A) Golden Gate B) Dumbarton C) Brooklyn D) Carquinez
4 The highest hand in poker is A) Straight Flush B) Four of a kind C) Full House D) Royal Flush
5 The game of Baseball has A) 9 innings B) 4 quarters C) 6 sets D) 2 periods
6 The most populated city in the USA is A) Los Angeles B) San Francisco C) New York City D) Chicago
7 The world city with the greatest population is A) Tokyo B) Delhi C) Guangzhou D) Karachi
8 The longest river in the world is A) Amazon B) Nile C) Lena D) Yangtze

Answers.txt

B

C

C

D

A

C

A

B

 

TIPS: Use functions like getQuestion getAnswer writeResults getUserInput,
openFiles and closeFiles. 
You can use a string data type for questions (don't forgit the header file
needed for using strings). 
It might also be useful for you to do a stub
program to arrange your functions before you begin coding them. Define your functions
in prototype statements before the main function

Submit the following to Catalyst:

Screen capture of the program run QuizCapture.jpg

Output file: Responses.txt

QuizProgram.cpp

 
Powered by