Question: 1) Description: Write a program that will test a user's knowledge based on multiple-choice questions that are loaded from a text file. The program starts


1) Description: Write a program that will test a user's knowledge based on multiple-choice questions that are loaded from a text file. The program starts by asking the user to type the file name of the questions to be loaded. Once the questions are read, the program will display one question at a time with the multiple choice answers below it. The user is then asked to enter a letter choice (a, b. c. or d) to select an answer. The program should display "Correct!" or "Wrong answer" and then proceed to the next question. Once all the questions are answered, the program should display the score of the user as a percentage So if the user answered 6 questions out of 10 correctly, it should display "Your score is 60% Your program should follow the specifications below: 1. You must create a data structure called Question which has the following members a. b. title (string): holds the text of the question. choices (array of strings): holds the four choices of each question. correct (int): holds a number which corresponds to the correct answer e.g. if choice c, is correct the c. correct should be 3 The program must use an array of the Question data type to store the questions and answers (a maximum of 50 allowed questions) 2. 3. The program must be able to load different files. See the files, question 5.txt, and 4. 5. 6. question_10.txt, which are attached with this homework blackboard post. The program must validate the user input. So if the user puts f' as a choice, it should ask the user to choose an answer again. Program must tell the user if the file name does not exist and ask the user to type in the file name again Youmay only use the functions and data types you have learned in class uestion File Specifications: The questions files contain text that will correspond to each question's text and answers The first line of each question will correspond to the title of the question. The following four lines will represent the answer choices. The correct answer is identified by a space then a star symbol (*). Each question (and its answers) are separated from the others using an empty line
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
