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.
Ok
HackerRank
|
Prepare
Certify
Compete
Hiring developers?
Log In
Sign Up
Prepare
C++
Classes
Classes and Objects
Discussions
Classes and Objects
Problem
Submissions
Leaderboard
Discussions
You are viewing a single comment's thread.
Return to all comments →
shashwatsaxena21
4 months ago
+ 0 comments
include
using namespace std;
class student {
private:
int a,b,c,d,e;
int total;
public:
void get_input(){
cin >> a >> b >> c >> d >> e;
}
int calculateTotalScore(){
total = a + b + c + d + e;
return total;
}
};
int main() {
int i,n,count;
student s;
cin >> n;
int a[n];
for (i = 0 ; i < n ; i++){
s.get_input();
a[i] = s.calculateTotalScore();
}
for ( i = 1 ; i < n ; i++){
if(a[0] < a[i])
count++;
}
cout << count << endl;
}
Classes and Objects
You are viewing a single comment's thread. Return to all comments →
include