-
Notifications
You must be signed in to change notification settings - Fork 0
/
Laba.cpp
87 lines (75 loc) · 1.08 KB
/
Laba.cpp
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
#include "StdAfx.h"
#include "Laba.h"
CLaba::CLaba(void)
: n(0)
{
}
CLaba::~CLaba(void)
{
}
discipline CLaba::GetDiscipline()
{
return current;
}
void CLaba::SetDiscipline(discipline d)
{
current=d;
}
void CLaba::SetTeacher(CTeacher SomeTeacher)
{
ZIPotalenko=SomeTeacher;
}
int CLaba::SetGroup(CStudent gr[], int quantity)
{
int i;
for(i=0; i<n; i++)
{
group[i]=gr[i];
}
n=quantity;
return 0;
}
void CLaba::Pair(int l)
{
int time, i, queue, someVar;
CStudent buf;
for(time=0;time<45;time++)
{
if((time+group[i].courage)%10==0)
{
ZIPotalenko.Potala(&group[i], current, l);
if(group[i].GetStatus(current,l))
{
i++;
}
else
{
buf=group[i];
for(int j=0; j<(n-1); j++)
{
group[j]=group[j+1];
}
group[n-1]=buf;
}
}
someVar=0;
for(j=0;j<(i+1+queue);j++)
{
someVar+=group[j].GetCurrentCourage();
}
if(time>someVar)
{
queue++;
}
for(j=i;j<(i+1+queue);j++)
{
group[j].Wait();
}
}
int sumWaiting=0, averegeWaiting=0;
for(i=0;i<n;i++)
{
sumWaiting+=group[i].GetTime();
}
averegeWaiting=sumWaiting/n;
}