In gymnastics or diving competitions, each contestant's score is calculated by dropping the lowest and highest scores and then adding the remaining scores. Write a program that allows the user to enter eight judge's score and outputs the points received by the contestant. Format your output with two decimal places.
1
Expert's answer
2011-11-25T10:21:41-0500
# include <iostream.h> # include <iomanip.h> void main(){ float a[8], min, max, res; int i; for (i=0;i<=7;i++){ & cout<<"Enter a score "<<i+1<<": "; & cin>>a[i]; } min = a[0]; max = a[0]; for (i=0;i<=7;i++){ & if (a[i]>max) max = a[i]; & if (a[i]<min) min = a[i]; } res = min + max; cout<<setprecision(3)<<res; }
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment