


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



-1.3, 5.2, 8.7, 0.0, -4.5, 7.8, -9.1, 3.5, 6.
Then the modified list should contain:
-1.3, -4.5, -9.1, 5.2, 8.7, 0.0, 7.8, 3.5, 6.
This is a challenging problem, but it is good practice. Try to do it in two different ways: one without using an extra list and one using an extra list.
b (( B Eee& &^E fg rz!!
is in alphabetical order, but:
b (( B Eee& &^Ea fg rz!!
is not.
class Course { public: Course(const string& id, unsigned int max_stu) : course_id(id), max_students(max_stu) {}
private: string course_id; list
Use this in solving each of the following problems.
(a) Provide three member functions: one returns the maximum number of students allowed in the Course, a second returns the number of students enrolled, and a third returns a bool indicating whether or not any openings remain in the Course. Provide both the prototype in the declaration above and the member function implementation. (b) Write a function that sorts course objects by increasing enrollment. In other words, the course having the fewest students should be first. If two courses have the same number of students, the course with the smaller maximum number of students allowed should be earlier in the sorted vector. (c) Write a member function of Course called merge. This function should take another Course object as an argument. All students should be removed from the passed Course and placed in the current course (the one on which the function is called). You may assume (just for this problem) that no students are enrolled in both courses and there is enough room in the current course. As an example if cs2 is of type Course and has 15 students and baskets is of type Course and has 5 students, then after the call cs2.merge(baskets); baskets will have no students and cs2 will have 20.
15, 45, 32, 16, 32, 83, 45, 89, 32, 15, 83
the function should return the value 32 because it occurs 3 times and no other value occurs more than twice.
int Add(int m, int n)
int Multiply(int m, int n)