We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
class Student{
public:
int a,b,c,d,e;
void input();
int calculateTotalScore();
};
void Student :: input(){
cin>>a>>b>>c>>d>>e;
}
int Student :: calculateTotalScore(){
int total = a+b+c+d+e;
return total;
}
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT /
int n;
cin>>n;
Student S = new Student[n];
S[0].input();
int Kristen = S[0].calculateTotalScore();
int count = 0;
for(int i = 1; i < n; i++){
S[i].input();
if(Kristen < S[i].calculateTotalScore()){
count++;
}
}
cout<
Classes and Objects
You are viewing a single comment's thread. Return to all comments →
include
include
include
include
include
using namespace std;
class Student{ public: int a,b,c,d,e; void input(); int calculateTotalScore();
};
void Student :: input(){ cin>>a>>b>>c>>d>>e; }
int Student :: calculateTotalScore(){ int total = a+b+c+d+e; return total; } int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT / int n; cin>>n; Student S = new Student[n]; S[0].input(); int Kristen = S[0].calculateTotalScore(); int count = 0; for(int i = 1; i < n; i++){ S[i].input(); if(Kristen < S[i].calculateTotalScore()){ count++; } } cout<