In: Computer Science
In C ++, Design and implement a program that reads from the user four integer values between 0 and 100, representing grades. The program then, on separate lines, prints out the entered grades followed by the highest grade, lowest grade, and averages of all four grades. Format the outputs following the sample runs below.
Sample run 1:
You entered: 95, 80, 100, 70
Highest grade: 100
Lowest grade: 70
Average grade: 86.25
#include <iostream> using namespace std; int main() { int a,b,c,d,max,min,sum; cin>>a; cin>>b; cin>>c; cin>>d; cout<<"You entered: "; cout<<a<<", "<<b<<", "<<c<<", "<<d<<endl; max = a; min = a; if(max < b){ max = b; } if(max < c){ max = c; } if(max < d){ max = d; } if(min > b){ min = b; } if(min > c){ min = c; } if(min > d){ min = d; } sum = a+b+c+d; cout<<"Highest grade: "<<max<<endl; cout<<"Lowest grade: "<<min<<endl; cout<<"Average grade: "<<(sum/4.0)<<endl; return 0; }