-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDorm_info.cpp
More file actions
102 lines (95 loc) · 2.15 KB
/
Copy pathDorm_info.cpp
File metadata and controls
102 lines (95 loc) · 2.15 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#include "Dorm_info.h"
#include "Student_info.h"
#include <fstream>
#include <string>
#include <vector>
using std::ifstream; using std::string;
using std::vector;
void readAddDorm(ifstream& is, Dorm_info& dorm)
{
extern iptData configData;
int tempInt;
int roomInt;
int addedFloor;
int addedRoom;
string doStr;
string tempStr;
char tempCh;
is >> tempInt >> doStr;
if (doStr == "FLOOR(s)")
{
dorm.floorNum += tempInt;
for (int i = configData.FLOOR; i < dorm.floorNum; i++)
{
Dorm_floor dFloor;
for (int j = 0; j < configData.ROOM; j++)
{
Dorm_room dRoom;
dRoom.bedNum = configData.CAPACITY;
dFloor.room.push_back(dRoom);
}
dFloor.roomNum = configData.ROOM;
dorm.floor.push_back(dFloor);
}
configData.FLOOR = dorm.floorNum;
}
else if (doStr == "ROOM(s)")
{
is >> tempStr; //TO
is >> roomInt;
is >> tempStr; //FLOOR
dorm.floor[roomInt - 1].roomNum += tempInt;
}
else if (doStr == "BED(s)")
{
is >> tempStr; //TO
is >> addedFloor;
is >> tempCh; //-
is >> addedRoom;
dorm.floor[addedFloor - 1].room[addedRoom - 1].bedNum += tempInt;
}
}
void readAddDorm_new(ifstream& is, Dorm_info& dorm)
{
extern iptData configData_new;
int tempInt;
int roomInt;
int addedFloor;
int addedRoom;
string doStr;
string tempStr;
char tempCh;
is >> tempInt >> doStr;
if (doStr == "FLOOR(s)")
{
dorm.floorNum += tempInt;
for (int i = configData_new.FLOOR; i < dorm.floorNum; i++)
{
Dorm_floor dFloor;
for (int j = 0; j < configData_new.ROOM; j++)
{
Dorm_room dRoom;
dRoom.bedNum = configData_new.CAPACITY;
dFloor.room.push_back(dRoom);
}
dFloor.roomNum = configData_new.ROOM;
dorm.floor.push_back(dFloor);
}
configData_new.FLOOR = dorm.floorNum;
}
else if (doStr == "ROOM(s)")
{
is >> tempStr; //TO
is >> roomInt;
is >> tempStr; //FLOOR
dorm.floor[roomInt - 1].roomNum += tempInt;
}
else if (doStr == "BED(s)")
{
is >> tempStr; //TO
is >> addedFloor;
is >> tempCh; //-
is >> addedRoom;
dorm.floor[addedFloor - 1].room[addedRoom - 1].bedNum += tempInt;
}
}