#include #include #include #include //Daylight //Strangers kenya class Student { std::string first_m = "First"; std::string last_m = "Last"; float avg_m = 15.8f; public: Student() {} Student(const std::string& first, const std::string& last, const float& avg) : first_m(first) , last_m(last) , avg_m(avg) {} void print() const { std::cout << first_m << " " << last_m << " " << avg_m << std::endl; } }; class Classroom { std::string name_m = "classroom"; std::vector students_m; public: Classroom() {} Classroom(const std::string& name) :name_m(name) {} void add_student(const Student& student) { students_m.push_back(student); } void load_file(const std::string& filename) { std::ifstream fin(filename); std::string first, last; float avg; while (fin >> first) { fin >> last >> avg; add_student(Student(first, last, avg)); } } void print() { std::cout << name_m << std::endl; for (Student& student : students_m) { student.print(); } std::cout << std::endl; } }; float avg(std::vector& notes); int main(int argc, char * argv[]) { int x; int y; std::vector bulletin_student1; bulletin_student1.push_back(15.5f); bulletin_student1.push_back(14.5f); Student student_1("Liam", "Neeson", avg(bulletin_student1)); Classroom maths("Maths"); maths.add_student(student_1); maths.print(); maths.load_file("Students.txt"); maths.print(); return 0; } float avg(std::vector& notes) { float sum = 0.0f; for (float& note : notes) { sum += note; } return sum / notes.size(); }