Tuesday, September 8, 2015

School Grading System in C++

A sample program that I wrote in my programming class in C++ before that teaches my student how to create and use functions in C++ I called this program school grading system in C++ I am using CodeBlocks as my text editor and Dev C++ as my C++ compiler.

If you have some questions about programming, about my work please send me an email at jakerpomperada@gmail.com and jakerpomperada@yahoo.com. People here in the Philippines can contact me at  my mobile number 09173084360.

Thank you very much and Happy Programming.


Program Listing

#include <iostream>
#include <iomanip>

using namespace std;

float grade_solve(float midterm, float final)
{
    float solve_grade=0.00;
    solve_grade = (midterm+final) / 2;

    if (solve_grade >= 5.0 && solve_grade <=10)
     {
         cout << "\n\n";
         setprecision(1);
         cout << " You Passed the subject with the grade of "
              << solve_grade << ".";
     }
    else {
          cout << "\n\n";
          setprecision(1);
          cout << " Sorry you Failed the subject with the grade of "
              << solve_grade << ".";
     }
}

main()
{
    float midterm_grade=0.00, endterm_grade=0.00;

    cout << "\t\t School Grading System";
    cout << "\n\n";
    cout << " Enter Midterm Grade :=> ";
    cin >> midterm_grade;
    cout << " Enter Endterm Grade :=> ";
    cin >> endterm_grade;

    grade_solve(midterm_grade,endterm_grade);
    cout << "\n\n";
}


No comments:

Post a Comment