#include<iostream> #include<cstdio> #include<cstdlib> #include<iomanip> usingnamespacestd; classScore { private: int Chinese, Math, English; staticint TotalScore; staticint TotalStudent; public: Score() {} voidsetScore(int c, int m, int e){ Chinese=c; Math = m; English = e; TotalStudent++; TotalScore = TotalScore + Chinese + Math + English;
} }; int Score::TotalScore=0; int Score::TotalStudent=0;
intmain(){ int n, op, i, c, m, e; cin >> n; int id = 1; Score sco[11]; while(n--) { cin >> op; if(op == 1) { cin >> c >> m >> e; sco[id].setScore(c,m,e);id++;
#include<iostream> usingnamespacestd; classTV; classRemote { public: Remote() {}; voidvolume_to(TV &tv, int x); voidchannel_to(TV &tv, int x); };
classTV { private: int state; int channel; int volume; public: friendvoid Remote::volume_to(TV &tv, int x); friendvoid Remote::channel_to(TV &tv, int x); TV() {}; TV(int st) :state(st),volume(20),channel(5){}
voidonoff(){ state = -state;
} voidcha_next(){ channel++;
} voidcha_pre(){ channel--;
} voidvol_up(){ volume++;
} voidvol_down(){ volume--;
} voidprint(){ if(state == -1) { cout << "The TV is OFF" << endl;
} else { cout << "The TV is ON" << endl; cout << "The channel is " << channel << endl; cout << "The volume is " << volume << endl;
} } };
void Remote::volume_to(TV &tv, int x) { tv.volume = x; } void Remote::channel_to(TV &tv, int x) { tv.channel = x; }