Question: Write a C + + program using FUNCTIONS to input 4 test scores and output the average of the 4 . In main ( )

Write a C++ program using FUNCTIONS to input 4 test scores and output the average of the 4.
In main (), declare 4 variables for 4 scores. You MUST name them XXscore1, XXscore2....where XX is your 2 initials. Mine would SKscore1..
Function 1: Get 4 scores as inputs from user. Return the4 scores to main(). Validate that none are negative. Return a boolean indicating whether data is good or bad.
Function 2: If the scores are all valid, calculate the average. Return value as double to main.
In main, output the average.
Extra credit: Drop the lowest user input and output the average of 3 temps.
SAMPLE:
Enter four scores (no negatives):80908090
Average of four is 85
Enter four scores (no negatives): 7080-6090
Bad Data: one of the scores is negative
Enter four scores (no negatives): 80908090
Average of three best scores is 86.6667(extra credit, lowest dropped)

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!