Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions