1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
#include <iostream>
#include <iomanip>
using namespace std;
void getScores(int&, int&, int&, int&, int&);
void showAverage(int&, int&, int&, int&, int&);
int main(){
int grade1, grade2, grade3, grade4, grade5;
getScores(grade1, grade2, grade3, grade4, grade5);
showAverage(grade1, grade2, grade3, grade4, grade5);
system("pause");
return 0;
}
int getScores(int &input1, int &input2, int &input3, int &input4, int &input5){
cout<<"Enter 5 grades "<<endl;
cin>>input1>>input2>>input3>>input4>>input5;
}
int showAverage(int &num1, int &num2, int &num3, int &num4, int &num5){
int sum;
cout<<"Now it will calculate average "<<endl;
sum = ((num1 + num2 + num3 + num4 + num5) / 5);
cout<<"Sum is "<<sum<<endl;
if (sum>=90)
cout<<"Your grade value is A \n";
else if (sum>=80)
cout<<"Your grade value is B \n";
else if (sum>=70)
cout<<"Your grade value is c \n";
else if (sum<=69)
cout<<"Your grade value is F \n";
}
|