-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHouse.cpp
More file actions
102 lines (94 loc) · 1.74 KB
/
House.cpp
File metadata and controls
102 lines (94 loc) · 1.74 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
#include "House.h"
House::House(int n)
{
this->size = n;
this->mas = new Flat[this->size];
for (int i = 0; i < this->size; i++)
{
this->mas[i].SetNumber(i + 1);
}
cout << "Vvedit adress:\n";
cout << "nazva vuluci:\t";
gets_s(this->Adress_Street);
cout << "nomer doma:\t";
cin >> this->numHouse;
cin.ignore();
}
void House::Zaselenie()
{
int num;
cout << "Vvedit nomer kvartiru:\t";
cin >> num;
cin.ignore();
if (num > 0 && num < this->size)
this->mas[num - 1].AddHuman();
else
cout << "Takogo nomera kvartiu net.\n";
}
void House::Vuselenie()
{
int num;
cout << "Vvedit nomer kvartiru:\t";
cin >> num;
cin.ignore();
if (num > 0 && num < this->size)
{
if (this->mas[num - 1].GetSize() != 0)
this->mas[num - 1].DelHuman();
else
cout << "Kvartira pysta.\n";
}
else
cout << "Takogo nomera kvartiu net.\n";
}
void House::Show()
{
cout << "Adress:\n";
cout<<"Vulucia:\t"<< this->Adress_Street << "\n";
cout << "Nomer doma:\t" << this->numHouse << "\n";
int f = 0;
for (int i = 0; i < this->size; i++)
{
if (this->mas[i].GetSize() != 0)
{
this->mas[i].Show();
f = 1;
}
}
if (f == 0)
cout << "Dom pyst.\n";
}
void House::ShowFlat()
{
int num;
cout << "Vvedit nomer kvartiru:\t";
cin >> num;
cin.ignore();
if (num > 0 && num < this->size)
{
if (this->mas[num - 1].GetSize() != 0)
this->mas[num - 1].Show();
else
cout << "Cia kvartira pysta\n.";
}
else
cout << "Takogo nomera kvartiu net.\n";
}
void House::FindGulca()
{
char str[20];
cout << "Vvedit Fio:\n";
gets_s(str);
int f = 0;
for (int i = 0; i < this->size; i++)
{
if (this->mas[i].FindFioByHuman(str) == 1)
f = 1;
}
if (f == 0)
cout << "Taka liuduna ne zaselena do kvartiru.\n";
}
House::~House()
{
delete[] this->mas;
}