C++
Lab 5.1
20 points
switch, functions
Proverbs Test
Using the table below, write a program that presents these seven proverbs one at a time and asks the user to evaluate them as true or false. The program should then tell the user how many questions were answered correctly and display one of the following evaluations: Perfect - all seven answers correct, Excellent - 5 or 6 correct, You might want to consider taking Psychology 101 - less than 5 correct.
Proverb | Truth Value
--------|------------
The squeaky wheel gets the grease | True
Cry and you cry alone | True
Opposites attract | False
Spare the rod and spoil the child | False
Actions speak louder than words | True
Familiarity breeds contempt | False
Marry in haste, repent at leisure | True
You must utilize at least two switch statements and three functions (including main) in your solution.
One solution could look like this, yours might be different:
- main: switch statement to present each of the proverbs in order, function call to funcl to process the answers (returning either true or false), accumulate correct answer total, function call to func2 to output the results (pass in total correct)
- funcl: ask user for answer, return true or false
- func2: switch statement to output results (7 correct == perfect, 5 or 6 correct == excellent, <5 correct == you should take Psychology 101)