You are viewing a single comment's thread. Return to all comments →
class student{ public: int arr[5]; int TotalScore(student a){ int total=0; for(int i=0;i<5;i++)total+=arr[i]; return total; } }; int main() { int n; cin>>n; student Kristen; for(int i=0;i<5;i++){ int temp; cin>>temp; Kristen.arr[i]=temp; } int KristenMarks=Kristen.TotalScore(Kristen); n--; int cnt=0; for(int i=1; i<=n;i++){ student s; for(int i=0;i<5;i++){ int temp; cin>>temp; s.arr[i]=temp; } int curr_marks=s.TotalScore(s); if(curr_marks>KristenMarks)cnt++; } cout<<cnt; return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Classes and Objects
You are viewing a single comment's thread. Return to all comments →