-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate.cpp
More file actions
59 lines (55 loc) · 1.88 KB
/
create.cpp
File metadata and controls
59 lines (55 loc) · 1.88 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
#include <type.h>
Dormitory *createDormitory ( int buildYear, char *Commandant, char *Addres){
Dormitory *dormitory = new Dormitory();
strncpy(dormitory->Commandant, Commandant, SIZE_NAME);
strncpy(dormitory->Addres, Addres, SIZE_ADDRES);
dormitory->buildYear = buildYear;
dormitory->arSize = 3;
dormitory->blockarray = new Block[dormitory->arSize];
dormitory->Countroom = 0;
return dormitory;
}
int createRoot (void *){
int BY = getInt("Enter build year(min 1900, max 2015): ",1900,2015);
char *Com = getStr("Enter name commandant: ");
if(strlen(Com)==0){
cout << "Name was not changed\n";
}
char *Addr = getStr("Enter addres: ");
if(strlen(Addr)==0){
cout << "Addra was not changed\n";
}
root = createDormitory(BY,Com,Addr);
log_file("Create root ");
return 1;
}
Block *createBlock (int Numblock, char *Starosta, int Floor){
Block *block = new Block();
strncpy (block->Starosta,Starosta,SIZE_NAME);
block->Numblock = Numblock;
block->Floor = Floor;
block->arSize = 3;
block->pRoomArray = new Room*[block->arSize];
block->countRoom = 0;
return block;
}
Room *createRoom (int NumberRoom, int KilkistLizok, float Square){
Room *room = new Room();
room->NumberRoom = NumberRoom;
room->KilkistLizok = KilkistLizok;
room->Square = Square;
room->firstInhab = NULL;
return room;
}
Inhabitant *createInhabitant (char *name, int YeartoRoom, char *Facult){
Inhabitant *inhab = new Inhabitant();
char *Inhabname = new char[SIZE_NAME];
strncpy (Inhabname,name, SIZE_NAME);
inhab->name = Inhabname;
inhab->YeartoRoom = YeartoRoom;
char *nameFacult = new char[SIZE_FACULT];
strncpy (nameFacult, Facult, SIZE_FACULT);
inhab->Facult = nameFacult;
inhab->nextInhab = NULL;
return inhab;
}