From 33613a85afc4b1481367fbe92a17ee59c240250b Mon Sep 17 00:00:00 2001 From: Sven Eisenhauer Date: Fri, 10 Nov 2023 15:11:48 +0100 Subject: add new repo --- Bachelor/Prog2/person-tree/Person.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Bachelor/Prog2/person-tree/Person.cpp (limited to 'Bachelor/Prog2/person-tree/Person.cpp') diff --git a/Bachelor/Prog2/person-tree/Person.cpp b/Bachelor/Prog2/person-tree/Person.cpp new file mode 100644 index 0000000..f1e5206 --- /dev/null +++ b/Bachelor/Prog2/person-tree/Person.cpp @@ -0,0 +1,31 @@ +// Person.cpp: Implementation of class Person + +#include +using std::cout; +using std::endl; +using std::ostream; + +#include +using std::string; + +#include "Person.h" + +Person::Person( string last, string first ) +{ + lastName = last; + firstName = first; +} + +bool Person::operator<( const Person& p ) const +{ + return lastName < p.lastName || + ( lastName == p.lastName && + firstName < p.firstName ); +} + +ostream& operator<<( ostream& output, const Person& p ) +{ + cout << p.lastName << ", " << p.firstName << endl; + + return output; +} \ No newline at end of file -- cgit v1.2.3