-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.cpp
More file actions
65 lines (47 loc) · 978 Bytes
/
Copy pathMain.cpp
File metadata and controls
65 lines (47 loc) · 978 Bytes
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
/*
P1 -> Process 1
P2 -> Process 2
P3 -> Process 3
P4 -> Process 4
P5 -> Process 5
*/
#include "SPN.h"
#include "Manager.h"
#include <cstdlib>
bool Table;
Process P1(rand() % 7 + 1), P2(rand() % 7 + 1),
P3(rand() % 7 + 1), P4(rand() % 7 + 1), P5();
Manager manager;
// DYNAMIC LIST
list<Process> P_queue;
uint contador_rev = 20;
uint contador_BT = 0;
main()
{
do
{
if((rand() % 2))
InsertProcess();
if(!P_queue.empty())
{
Process current_process = P_queue.front();
do
{
if((rand() % 2))
InsertProcess();
} while (contador_BT > 0);
}
contador_BT = 0;
} while (contador_rev == 0);
}
Process InsertProcess()
{
switch (rand() % 10 + 1)
{
case 1:
manager.OrderedInsert(P1, P_queue);
break;
default:
break;
}
}