Untitled
unknown
plain_text
a year ago
647 B
0
Indexable
Never
#include <iostream> #include <vector> using namespace std; class schooler { private: string name; vector<int> marks; public: void addmark(int a) { marks.push_back(a); } void printMarks() { for (int i=0; i < marks.size(); i++) { cout << marks[i]; } } void getSr() { int a = 0; for (int j=0; j < marks.size(); j++) { a += marks[j]; } cout << a / marks.size(); } }; int main() { string name; schooler Arthur; Arthur.addmark(2); Arthur.printMarks(); cout << endl; Arthur.getSr(); }