-
Notifications
You must be signed in to change notification settings - Fork 0
/
LoadSchedule.h
60 lines (43 loc) · 1.26 KB
/
LoadSchedule.h
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include <fstream>
#include <iostream>
#include <vector>
#include <string>
#include "Student.h"
#include "UcTurma.h"
#include "Manager.h"
using namespace std;
void loadSchedule(Manager& m)
{
string FILENAME = "classes.csv";
ifstream file;
string file_text;
std::string::size_type sz;
file.open(FILENAME);
vector<ClassSchedule> v;
//Eliminate first line
getline(file, file_text);
while(!file.eof()) {
getline(file, file_text, ',');
string classCode = file_text;
getline(file, file_text, ',');
string ucCode = file_text;
getline(file, file_text, ',');
string weekDay = file_text;
getline(file, file_text, ',');
string aux = file_text;
double startHour = atof(aux.c_str());
getline(file, file_text, ',');
aux = file_text;
double duration = atof(aux.c_str());
getline(file, file_text);
string type = file_text;
if (classCode != "")
{
UcTurma u = UcTurma(ucCode, classCode);
ClassSchedule c = ClassSchedule(u, weekDay, startHour, duration, type);
v.push_back(c);
}
}
m.set_schedule(v);
file.close();
}