-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
80 lines (80 loc) · 2.82 KB
/
main.cpp
File metadata and controls
80 lines (80 loc) · 2.82 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
#include <iostream>
#include <string>
#include "ArrayPriorityQuoue.h"
#include "HeapPriorityQuoue.h"
#include "PriorityQueue.h"
#include "ui.h"
using namespace std;
int main(){
int ntests = 0;
do{
cout << "Czy przeprowadzić badania 1 - tak 0 - nie: ";
cin >> ntests;
}while (ntests != 0 && ntests != 1);
if(ntests){
cout << "Start Badań\n";
tests();
cout << "Koniec Badań\n";
}else{
int start = 1, operation = 1, size = 0;
while(start){
operation = 1;
do{
cout << "Ile danych w struktórach chcesz przechowywać: ";
cin >> size;
}while(size < 0);
generateToFile(size);
std::cout << "Dane zostały wygenerowane i zapisane do pliku 'data.txt'.\n";
HeapPriorityQueue<int> heapQueue("data.txt");
ArrayPriorityQueue<int> arrayQueue("data.txt");
while(operation){
cout << "1. Dodaj element do kolejki\n";
cout << "2. Usuń element o najwyższym priorytecie\n";
cout << "3. Podejrzyj element o najwyższym priorytecie\n";
cout << "4. Zmodyfikuj priorytet elementu\n";
cout << "5. Zmniejsz o 1 priorytet elementu\n";
cout << "6. Zwiększenie o 1 priorytery elementu\n";
cout << "7. Zwróć rozmiar struktury\n";
cout << "8. Wyświetl zawartośc struktór\n";
cout << "0. Wygeneruj dane na nowo\n";
cout << "Podaj operacje do wykoaniania: ";
cin >> operation;
switch (operation){
case 1:
insertUi(arrayQueue,heapQueue);
break;
case 2:
extractMaxUi(arrayQueue,heapQueue);
break;
case 3:
findMaxUi(arrayQueue,heapQueue);
break;
case 4:
modyfiKeyUi(arrayQueue,heapQueue);
break;
case 5:
increaseKeyUi(arrayQueue,heapQueue);
break;
case 6:
reduceKeyUi(arrayQueue,heapQueue);
break;
case 7:
getSizeUi(arrayQueue,heapQueue);
break;
case 8:
printUi(arrayQueue,heapQueue);
break;
case 0:
break;
default:
cout << "Nie ma takiej operacji.";
break;
}
}
do{
cout << "Chcesz kontunuować program? 1 - tak 0 - nie: ";
cin >> start;
}while(start != 0 && start != 1);
}
}
}