Answered step by step
Verified Expert Solution
Question
1 Approved Answer
, A50 - + Instructions You will be writing a program that can create and play a trivia gantie with four true or false questions,
, A50 - + Instructions You will be writing a program that can create and play a trivia gantie with four true or false questions, Write a program named trivia.cpp that creates the quiz first: Use two parallel arrays: string question 4 and bool answer [4] In a loop, ask the user to enter 5 questions and their corresponding answers Accept".","+", "True", and "true" as Boolean true Accept".","I", "False", and "false" as Boolean false o Use an input validation loop to make sure the user enters true or false After the questions are modified, the quiz can be played: . In a loop, display the question and ask for a guess Accept".","+", "True", and "true" as Boolean true Accept "E", "I", "False", and "false" as Boolean false At the end of the quiz, display how many questions the user guessed correctly Sample Output Let's build a trivia of true or false questions! Please enter Question 1: school buses are YELLOW Please enter Answer 1 (T, L, True, true, E, F, False, false): maybed Invalid input, try again! Please enter Answer i (T, t, True, true, F, I, False, false): Please enter Question 2: WHITEBOARDS ARE YELLOW Please enter Answer 2 (T, t, True, true, F, E, False, false): False Please enter Question 3 : Bananas are yellow WHITEBOARDS ARE YELLOW Please enter Answer 2 (T, t, True, true, F, E, False, false): False Please enter Question 3 : Bananas are yellow Please enter Answer ? (T, t, True, true, F, E, Talse, false): true Please enter Question: 4: ORaNges ArE YELLOW Please enter Answer 4 (T, t, True, true, F, E, False, false): Let's play the game! Question 1: school buses are YELLOW Please enter a guess (T, t, True, true, E, F, False, false): Question 2: WHITEBOARDS ARE YELLOW Please enter a guese (T, I, True, true, F, I, False, false): Question 3: Bananas are yellow Please enter a guess (T, t., True, true, F, I, False, false): Question 4: Oranges Ars YELLON Please enter a guess (T, t., True, true, F, I, False, false): You guessed 2 out of 4 cuestions correcalv
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered 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