flow chart

closed account (1RLTURfi)
anyone help me in flow chart.

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


double checkScore_exam(double); // function prototype
double checkScore_quiz(double); // function prototype
double checkScore_programming_assignment(double); // function prototype
double checkScore_lab_exercise(double); // function prototype
double checkScore_test(double); // function prototype
double get_Final_Score(double,double,double,double,double); // function prototype
void grade(double ); // function prototype



struct student
{
int student_id;
double exam_mark;
double quiz_mark;
double programming_mark;
double lab_mark;
double test_mark;
};


int main()


{
int student_id ;
double score, exam_mark , quiz_mark , programming_mark , lab_mark , test_mark ;


do
{

cout << "\nPlease enter your student number.(enter 999 to exit)" << endl;
cin >> student_id;

if ( student_id == 999 )
break;


do
{

cout << "\nPlease enter your marks for exam." << endl;
cin >> exam_mark;
checkScore_exam(exam_mark); // function called here

} while ( exam_mark > 100 || exam_mark < 0 );


do
{

cout << "\nPlease enter your marks for quiz." << endl;
cin >> quiz_mark;
checkScore_quiz(quiz_mark); // function called here


} while ( quiz_mark > 100 || quiz_mark < 0 );

do
{

cout << "\nPlease enter your marks for programming assignment." << endl;
cin >> programming_mark;
checkScore_programming_assignment(programming_mark); // function called here


} while ( programming_mark > 100 || programming_mark < 0 );


do
{

cout << "\nPlease enter your marks for lab exercise." << endl;
cin >> lab_mark;
checkScore_lab_exercise(lab_mark); // function called here


} while ( lab_mark > 100 || lab_mark < 0 );


do
{

cout << "\nPlease enter your marks for test." << endl;
cin >> test_mark;
checkScore_test(test_mark); // function called here


} while ( test_mark > 100 || test_mark < 0 );


cout << "\nStudent Number:" << " " << student_id << endl;
cout << "=======================";
cout << "\nMarks for exam is:" << " " << exam_mark << endl;
cout << "Marks for quiz is:" << " " << quiz_mark << endl;
cout << "Marks for programming assignment is:" << " " << programming_mark << endl;
cout << "Marks for lab exercise is:" << " " << lab_mark << endl;
cout << "Marks for test is:" << " " << test_mark << endl;


score = get_Final_Score(exam_mark, quiz_mark ,programming_mark , lab_mark , test_mark); // function called here


cout << "Final Score is" << " " << score << endl;

grade(score); // function called here

}

while( exam_mark <= 100 || quiz_mark <= 100 || programming_mark<= 100 || lab_mark <= 100 || test_mark <= 100 || exam_mark >= 0 || quiz_mark >= 0 || programming_mark >= 0 || lab_mark >= 0 || test_mark >= 0 );

system ("pause");

return 0;

}

double checkScore_exam(double exam)
{

if ( exam > 100 || exam < 0 )
cout << "Invalid mark was entered.\nPlease enter again!" << endl;

return exam;


}

double checkScore_quiz(double quiz)
{

if ( quiz > 100 || quiz < 0 )
cout << "Invalid mark was entered.\nPlease enter again!" << endl;

return quiz;


}

double checkScore_programming_assignment(double programming)
{

if ( programming > 100 || programming < 0 )
cout << "Invalid mark was entered.\nPlease enter again!" << endl;


return programming;
}

double checkScore_lab_exercise(double lab)
{

if ( lab > 100 || lab < 0 )
cout << "Invalid mark was entered.\nPlease enter again!" << endl;

return lab;
}

double checkScore_test(double test)
{

if ( test > 100 || test < 0 )
cout << "Invalid mark was entered.\nPlease enter again!" << endl;

return test;
}

double get_Final_Score(double exam ,double quiz ,double programming ,double lab , double test)
{
double score;

double mark_exam = (exam / 100) * 30; // find final score for the exam mark
double mark_quiz = (quiz / 100) * 10; // find final score for the quiz mark
double mark_programming = (programming / 100) * 15; // find final score for the programming assignment mark
double mark_lab = (lab / 100) * 25; // find final score for the lab exercise mark
double mark_test = (test / 100) * 20; // find final score for the test mark
double total_mark = (mark_exam + mark_quiz + mark_programming + mark_lab + mark_test); // find total score of all the components
return total_mark;


return total_mark ;
}

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;

}
Topic archived. No new replies allowed.