Skip to content

Instantly share code, notes, and snippets.

@madelinecr
Created May 7, 2014 00:02
Show Gist options
  • Save madelinecr/0ccd48f04303c494b633 to your computer and use it in GitHub Desktop.
Save madelinecr/0ccd48f04303c494b633 to your computer and use it in GitHub Desktop.
diff --git a/Depot.cpp b/Depot.cpp
index 6083658..b6f2c66 100644
--- a/Depot.cpp
+++ b/Depot.cpp
@@ -5,6 +5,7 @@
#include "Depot.h"
#include <fstream>
#include <iostream>
+#include <algorithm>
using std::ifstream;
using std::cout;
using std::endl;
@@ -68,6 +69,9 @@ Depot::Depot()
cout << "Error: Could not open file exceptions.txt" << endl;
}
+ // sort employees
+ sort(workers.begin(), workers.end());
+
file.open("equipment.txt");
if (file.is_open())
diff --git a/Depot.o b/Depot.o
index 2989779..b665e90 100644
Binary files a/Depot.o and b/Depot.o differ
diff --git a/Employee.h b/Employee.h
index 71d7dc1..1a0790e 100644
--- a/Employee.h
+++ b/Employee.h
@@ -24,6 +24,10 @@ class Employee
int get_id();
~Employee();
+ bool operator < (const Employee& emp) const {
+ return (grade < emp.grade);
+ }
+
private:
string name;
int id;
diff --git a/part_1 b/part_1
index c3961cd..4bffe19 100755
Binary files a/part_1 and b/part_1 differ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment