diff options
| author | Fuwn <[email protected]> | 2024-05-18 00:38:03 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-05-18 00:38:03 -0700 |
| commit | b6233bd925eb8bcf848e580371814e3bd745c63f (patch) | |
| tree | 0ab5728b7153c435ad4dadcb42af9e744f70da9a /School_Driver.cpp | |
| parent | f (diff) | |
| download | cst_136_assignment_07-main.tar.xz cst_136_assignment_07-main.zip | |
Diffstat (limited to 'School_Driver.cpp')
| -rw-r--r-- | School_Driver.cpp | 45 |
1 files changed, 36 insertions, 9 deletions
diff --git a/School_Driver.cpp b/School_Driver.cpp index 356eee5..98e2004 100644 --- a/School_Driver.cpp +++ b/School_Driver.cpp @@ -3,19 +3,46 @@ #include "University.hh" #include <iostream> +template <typename L, typename R> +auto same_university(std::string, const L &, const R &) -> void; + auto main() -> int { University university; - College college("College of Cool", 1, 3.5); + + university.set_univ_pin(1337); + + College college("College of Cool", "Portland", 1, 3.5, university); High_School high_school("Cool High School", 2, 3.7); - auto same_college = [](University &college, University &university) { - if (college == university) { - std::cout << "Same college\n"; - } else { - std::cout << "Different college\n"; - } - }; - same_college(college, university); + college.set_college_name("College of Cool II"); + college.set_college_location("Los Angeles"); + college.set_college_rank(7); + college.set_reqd_gpa_for_admit(3.99); + college.print_pin(); + + high_school.set_high_school_name("Cool High School II"); + high_school.set_high_school_location("New York"); + high_school.set_high_school_rank(2); + high_school.set_reqd_gpa_for_admit(3.2); + high_school.print_pin(); + + same_university("\ncollege(university) == university", college, university); + same_university("high_school == university", high_school, university); + same_university("university == university", university, university); + same_university("university(anonymous) == university", University(), + university); + + high_school.set_university_pin(university); + + same_university("high_school(university) == university", high_school, + university); return 0; } + +template <typename L, typename R> +auto same_university(std::string description, const L &left, const R &right) + -> void { + std::cout << description << ": universities are " + << (left == right ? "the same" : "different") << ".\n"; +} |