Question
Write a program that stores answers to ten questions in a character array. Each question has one correct answer and four possible answers. (A,B,C,D). Prompt
Write a program that stores answers to ten questions in a character array. Each question has one correct answer and four possible answers. (A,B,C,D).
Prompt the user for ten guesses and store the users answers in another array.
After the user is done entering the answers, show them the correct answer, their answer, and whether they got the question correct or not.
Also show them how many they got right, and how many they got wrong.
char answers[] = {'A', 'B', 'C', 'D', 'B', 'A', 'B', 'C', 'D', 'A'};
char guesses[10]; //this will store the user answers
Sample Execution:
Enter your guess for Question 1 (A,B,C,D): A
Enter your guess for Question 2 (A,B,C,D): B
Enter your guess for Question 3 (A,B,C,D): F
ERROR!! Guess must be A,B,C,D
Enter your guess for Question 3 (A,B,C,D): D
Enter your guess for Question 10 (A,B,C,D): D
Here are the results of your quiz:
Question 1: Correct Answer: A Your Answer: A Correct.
Question 2: Correct Answer: B Your Answer: B Correct.
Question 3: Correct Answer: C Your Answer: D Incorrect.
Question 10: Correct Answer: A Your Answer: D Incorrect.
You got 4 questions right.
You got 6 questions wrong.
You got 40%.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started