Question: Programming Exercise 8.5 Three-Question Quiz, v.2.0 Purpose. Learn how to use function for code reuse, by modifying an existing program that repeats the same code

Programming Exercise 8.5 Three-Question Quiz, v.2.0 Purpose. Learn how to use function for code reuse, by modifying an existing program that repeats the same code 3 times. Also learn how to apply C++ prototypes. Requirements. Rewrite Exercise 6.1's threeQuestions1.cpp program, naming the new program threeQuestions2.cpp. Design one generic function to ask a question, collect an answer from the user via console input, and output whether the answer is correct or not. Modify your program to use the function, so that the details of prompting the user and testing the answers is in the function and not in main. You decide whether to use a void- or value-returning function. Use at least one parameter for the question and at least one for the correct answer. In case of multiple correct answers, use multiple parameters and or-logic. For example, \"who founded Microsoft\" accept Bill Gates\" or \"Gates DOs and DON'Ts: Do not write just one function that contains all three questions. Do not write three separate functions, one for each question. Do write one generic function that can be used to ask any question and check its answer. Do call that one function three times in main. OPTION: Use a prototype for the function, and write the function's definition below main. Program VO. This should work exactly like v.1.0 from Exercise 6.1. Examples. Here's what the output should look like, with user input in blue: 1. Who invented computers? Bill Gates Incorrect! 2. When were computers invented: 1999 Incorrect! 3. How many computer languages are there? Lots Correct!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!