Monday, August 9, 2021

Grade Solver Using Functions in C++

 A simple grade solver using a function that I wrote in my class in C++ programming.

 am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website, kindly contact me also at my email address also. Thank you.

My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.




Program Listing

#include <iostream>

#include <iomanip>


using namespace std;


 float average(float prelim, float midterm, float final)

  {

      float compute=0;

      bool value;


      compute = (prelim * 0.30) +

                (midterm * 0.30) +

                (final * 0.40);


       if (compute >= 75.00) {

         value = true;

       }

       else

       {

           value = false;

       }


       switch(value) {


           case true : cout << "You Passed !!!";

                       break;

           case false : cout << "You Failed";

                       break;

       }

       cout << "\n\n";

       return(compute);

  }


  main() {

      float pre=0,mid=0,fin=0;


  cout << "\tGrade Solver Using Functions in C++";

  cout << "\n\n";

  cout << "Enter Prelim Grade :=> ";

  cin >> pre;

  cout << "Enter Midterm Grade :=> ";

  cin >> mid;

  cout << "Enter Final Grade :=> ";

  cin >> fin;

  cout << "\n\n";

  cout << fixed << setprecision(2);

  cout << "Your average grade is "

       <<average(pre,mid,fin)<<".";


  cout << "\n\n";

  system("PAUSE");

  }




No comments:

Post a Comment