looping problem!

closed account (1RLTURfi)
someone help me check my code..

#include <iostream>
#include <cmath>
using namespace std;

double get_score(double,double,double,double,double);
double get_Final_Score(double,double,double,double,double);
void grade(double );

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;


return avg_a ;
}

void grade(double score)
{

if ( score >= 0 && score <= 49.9)
cout << "Grade is" << " " << "F" << endl;
else if ( score >= 50 && score <= 59.9 )
cout << "Grade is" << " " << "D" << endl;
else if ( score >= 60 && score <= 69.9 )
cout << "Grade is" << " " << "C" << endl;
else if ( score >= 70 && score <= 79.9 )
cout << "Grade is" << " " << "B" << endl;
else if ( score >= 80 && score <= 100 )
cout << "Grade is" << " " << "A" << endl;


return;

}
Whats the problem? And could you please put your code in code tags lo cated to the right; the "<>" icon/
Topic archived. No new replies allowed.