cout << "Please enter your student number." << endl;
cin >> a;
cout << "\nPlease enter your marks for exam." << endl;
cin >> b;
cout << "\nPlease enter your marks for quiz." << endl;
cin >> c;
cout << "\nPlease enter your marks for programming assignment." << endl;
cin >> d;
cout << "\nPlease enter your marks for lab exercise." << endl;
cin >> e;
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);
system ("pause");
return 0;
}
double get_score(double b , double c ,double d , double e , double f)
{
if ( b > 100 )
cout << "Invalid mark was entered." << endl;
if ( c > 100 )
cout << "Invalid mark was entered." << endl;
if ( d > 100 )
cout << "Invalid mark was entered." << endl;
if ( e > 100 )
cout << "Invalid mark was entered." << endl;
if ( f > 100 )
cout << "Invalid mark was entered." << endl;
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;
You can put a do...while loop in your main() function...
eg.
1 2 3 4 5 6 7 8 9 10
bool repeatProcess = false;
do
{
// your logic
// Ask if whether they want to repeat the process and set repeatProcess variable based on
// their input
}
while(repeatProcess);
eh.."the invalid mark was entered".i wan use this as function.but its was weird.you try run it.after i type in 5 integer those are >100,the "invalid mark was entered" only appear , 5 times appear.u get what i said .keke