Tuesday, April 4, 2023

Average Quiz OOP in C++

 A simple object oriented programming program to compute the average quiz of the students using 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

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


You can buy my C++ book online at  


https://www.mindshaperspublishing.com/product/beginners-guide-to-c-programming/


You can buy my book in introduction to computer networking at 

https://www.unlimitedbooksph.com/product-page/introduction-to-computer-networking


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 <iomanip>


#define MAX 3


using namespace std;


class Student {

private:

    string name[MAX];

    int q1[MAX];

    int q2[MAX];

    int q3[MAX];

    float ave(int a, int b, int c);

public:

    void getRec();

    void display();

};


void Student::getRec(){

int i;

for (i=0;i<MAX;i++){

    cout <<"Name: ";

    cin >> name[i];

    cout << "Input quiz 1: ";

    cin >> q1[i];

    cout << "Input quiz 2: ";

    cin >> q2[i];

    cout << "Input quiz 3: ";

    cin >> q3[i];

   }

}

void Student::display(){

int i;

float av;

system("cls");

cout <<"\n\n";

cout <<"\tAverage Quiz OOP in C++\n\n";

cout << " Name\tQuiz1\tQuiz2\tQuiz3\tAverage\tRemarks\n";


for (i=0;i<MAX;i++){

    av = ave(q1[i],q2[i],q3[i]);

    cout << fixed << setprecision(0);

    cout <<name[i]<<"\t"<<q1[i]<<"\t"<<q2[i]<<"\t"<<q3[i]<<"\t"<<av;


    if (av >= 75.0)

        cout <<"\tPassed.\n";

    else

        cout <<"\tFailed."<<endl;

    }

}

float Student::ave(int a, int b, int c){

   return ((a+b+c)/3.0);

}


int main(){

Student course;

course.getRec();

course.display();

}



No comments:

Post a Comment