-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScheduleChecker.h
More file actions
30 lines (25 loc) · 894 Bytes
/
ScheduleChecker.h
File metadata and controls
30 lines (25 loc) · 894 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#pragma once
#include <iostream>
#include <fstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <sstream>
#include <algorithm>
using namespace std;
class ScheduleChecker {
public:
ScheduleChecker(const string &prereqFile, const string &scheduleFile);
ScheduleChecker(); // added because map requires default constructor for [] operands, should never be called
void loadFiles(const std::string &prereqFile, const std::string &scheduleFile);
bool checkSchedule();
private:
bool checkDuplicateCourses(const string &course);
bool checkMaxCoursesPerSemester(const string &semester);
bool checkPrerequisites(const string &course);
unordered_map<string, string> prerequisites;
unordered_map<string, int> semesterCounts;
unordered_set<string> takenCourses;
vector<pair<string, string>> schedule;
};