Write a program to declare at least two objects people of yo
Write a program to declare at least two objects (people) of your new class and test each of the functions .
You can place your class definition in a header file and \"include\" it in your program, but it isn\'t necessary. Instead build it in the program itself, and in the interest of easy debugging, I recommend you do that for this program (example attached).
Now you want to enhance your student scholarship program hold an array of 3 students, include member functions to compare the GPAs and announce the winner of the scholarship based on the highest score.
You may wish to step up to this simply comparing two of the objects at a time. Remember that an object can be the parameter (argument) to another object\'s member functions.
I am struggling writting a good enough core program, and I have two assignments that follow this particular one. I need help writting a basic program that\'s easy to modify with those requirments.
Solution
class student
{
int a[3];
public:
//method to display marks
void display(int x[3])
{
int i=0;
for(i=0;i<3;i++)
cout<<a[i]<<\" \";
}
//method to compare the scores
int compare()
{
int max;
for(int i=0;i<3;i++)
{
if(max<a[i])
max=a[i];
}
return max;
}
};
#include<iostream>
using namespace std;
int main()
{
//declaring two objects
student s1,s2;
int max;
//initializing the arrays
int a[3]={33,55,22};
int b[3]={44,98,04};
//calling display method for both the arrays
cout<<\" Among the following scores \"<<endl;
s1.display(a);
max=s1.compare();
cout<<endl<<\"the highest score is\"<<max;
cout<<\" Among the following scores \"<<endl;
s2.display(b);
max=s2.compare();
cout<<endl<<\"the highest score is\"<<max;
return 0;
}

