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 test scores and output the average of the
In main declare variables for scores. You MUST name them XXscore XXscorewhere XX is your initials. Mine would SKscore
Function : Get scores as inputs from user. Return the scores to main Validate that none are negative. Return a boolean indicating whether data is good or bad.
Function : 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 temps.
SAMPLE:
Enter four scores no negatives:
Average of four is
Enter four scores no negatives:
Bad Data: one of the scores is negative
Enter four scores no negatives:
Average of three best scores is extra credit, lowest dropped
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
