int main()
{
int a ;
double score, b , c , d , e , f ;
do
{
cout << "\nPlease enter your student number." << endl;
cin >> a;
cout << "\nPlease enter your marks for exam." << endl;
cin >> b;
get_score(b,c,d,e,f);
cout << "\nPlease enter your marks for quiz." << endl;
cin >> c;
get_score(b,c,d,e,f);
cout << "\nPlease enter your marks for programming assignment." << endl;
cin >> d;
get_score(b,c,d,e,f);
cout << "\nPlease enter your marks for lab exercise." << endl;
cin >> e;
get_score(b,c,d,e,f);
cout << "\nPlease enter your marks for test." << endl;
cin >> f;
get_score(b,c,d,e,f);
cout << "\nStudent Number:" << " " << a << endl;
cout << "=======================";
cout << "\nMarks for exam is:" << " " << b << endl;
cout << "Marks for quiz is:" << " " << c << endl;
cout << "Marks for programming assignment is:" << " " << d << endl;
cout << "Marks for lab exercise is:" << " " << e << endl;
cout << "Marks for test is:" << " " << f << endl;
score = get_Final_Score(b, c ,d , e ,f ); //function called here
cout << "Final Score is" << " " << score << endl;
grade(score);
}
while( b <= 100 || c <= 100 || d <= 100 || e <= 100 || f <= 100 );
system ("pause");
return 0;
}
double get_score(double b,double c,double d,double e,double f)
{
do
{
cout << "Invalid mark was entered.\nPlease enter again!" << endl;
}
while ( b > 100 || c > 100 || d > 100 || e > 100 || f > 100 );
return b,c,d,e,f;
}
double get_Final_Score(double b ,double c ,double d ,double e , double f)
{
double score;
double avg_b = (b / 100) * 30; // finds average of b
double avg_c = (c / 100) * 10; // finds average of c
double avg_d = (d / 100) * 15; // finds average of d
double avg_e = (e / 100) * 25; // finds average of e
double avg_f = (f / 100) * 20; // finds average of f
double avg_a = (avg_b + avg_c + avg_d + avg_e + avg_f);
return avg_a;