Sunday, June 19, 2022

Grade Solver Using Pointers in C++

 A simple program that I wrote to solve the grade of the student using struct and pointers in C++ programming language.

I 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 in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg

=================================================


Want to support my channel?

GCash Account

Jake Pomperada

09173084360


Paypal

https://paypal.me/jakerpomperada


Patreon

https://www.patreon.com/jakerpomperada


Thank you very much for your support.




Program Listing

#include <iostream> 

#include <string>

#include <iomanip>

using namespace std;

struct student {
    string name;
    int age;
    float prelim,midterm,endterm;
};


float compute_grade(float *prelim,
                   float *midterm,
                   float *endterm)
{
  float solve=0.00;
  string remarks;

  solve = (*prelim * 0.30) +
          (*midterm * 0.30) +
          (*endterm * 0.40);

 if (solve >= 75.00)  {
     remarks = "PASSED";
 }
 else {
     remarks = "FAILED";
 }

 cout << fixed;
 cout << setprecision(0);
 cout << "\n\nThe student grade is " << solve
    << setw(10) << "Remarks: " <<setw(3)
    << remarks << ".";
 return(solve);
}


 int main() {


     student user;
     float *mypointer;

     cout << "\n\n";
     cout << "\t\tGrade Solver Using Pointers in C++";
     cout << "\n\n";
     cout << "\t Created By: Mr. Jake R. Pomperada, MAED-IT, MIT";
     cout << "\n\n";
     cout << "Enter the Name of the Student :";
     getline(cin,user.name);
      cout << "\n";
     cout << "Enter the Age of the Student  :";
     cin >> user.age;
     cout << "\n";
     cout << "Enter the Prelim Grade :";
     cin >> user.prelim;
     mypointer = &user.prelim;
     cout << "\n";
     cout << "Enter the Midterm Grade :";
     cin >> user.midterm;
     mypointer = &user.midterm;
     cout << "\n";
     cout << "Enter the Endterm Grade :";
     cin >> user.endterm;
     mypointer = &user.endterm;
     cout << "\n\n";
     cout << "\t ===== GENERATED REPORT =====";
     cout << "\n\n";
     cout << "\nStudent Name : " << user.name;
     cout << "\nStudent Age  : " << user.age;
     compute_grade(&user.prelim,&user.midterm,&user.endterm);


     cout << "\n\n";

     system("pause");
 }



No comments:

Post a Comment