The document defines a Student class to store student information like name, code, age, and subject scores. It also defines a StudentManager class to manage a list of students. The main function adds some sample students and prints their information.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
9 views4 pages
Code
The document defines a Student class to store student information like name, code, age, and subject scores. It also defines a StudentManager class to manage a list of students. The main function adds some sample students and prints their information.
class Student { private: string name; int code; int age; double math_score; double english_score; double literature_socre; public: //Hàm khoi tao Student(string n, int c, int a, double math, double english, double literature) { name = n; age = a; math_score = math; english_score = english; literature_socre = literature; }
// ham tra ve ten hoc sinh
string get_name() { return name; }
// Hàm tra ve tuoi cua hoc sinh
int get_age() { return age; } //ham tra ve diem toan cua hoc sinh double get_math_score() { return math_score; }
double get_literature_socre(){ return literature_socre; } // ham tra ve diem trung binh cua hoc sinh double get_average_score() { return (math_score + english_score + literature_socre) / 3.0; }
class StudentManager { private: vector<Student> students; public: // ham them hoc sinh moi void add_student(Student student) { students.push_back(student); } // Hàm in danh sach hoc sinh ra man hinh void print_students() { for (int i = 0; i < students.size(); i++) { students[i].print_info(); cout << endl; } } };
int main() { // tao doi tuong quan li hoc sinh StudentManager manager;