-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.cpp
More file actions
91 lines (83 loc) · 2.17 KB
/
Copy pathmain.cpp
File metadata and controls
91 lines (83 loc) · 2.17 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
#include <iostream>
#include <time.h>
#include "Array.h"
using namespace std;
int main()
{
double time1, time2;
long long int N, i;
do
{
cout << "Enter N: " << endl;
cin >> N;
Array Arr(N);
int menu;
cout << "________________________________________________________________________________" << endl;
cout << " | MENU | " << endl;
cout << "________________________________|___________|___________________________________" << endl;
cout << "1) Quiq sort;\n2) Marge sort\n3) Heap sort\n4) Bubble sort\n5) Insert sort\n6) New array\n7) Exit.\n\n\n";
do
{
cout << "\nEnter number of menu: ";
cin >> menu;
switch (menu)
{
case 1:
{
cout << "\n\nQUIQ SORT\n\n";
time1 = double(clock()) / CLOCKS_PER_SEC;
Arr.Quiq_sort(0, N - 1);
time2 = double(clock()) / CLOCKS_PER_SEC;
Arr.Print();
cout << "\nTime: " << double(time2 - time1) << "s\n\n";
}
break;
case 2:
{
cout << "\n\nMERGE SORT\n\n";
time1 = (double)clock() / CLOCKS_PER_SEC;
Arr.Merge_sort(0, N - 1);
time2 = (double)clock() / CLOCKS_PER_SEC;
Arr.Print();
cout << "\nTime: " << double(time2 - time1) << "s\n\n";
}
break;
case 3:
{
cout << "\n\nHEAP SORT\n\n";
time1 = (double)clock() / CLOCKS_PER_SEC;
Arr.Heap_sort();
time2 = (double)clock() / CLOCKS_PER_SEC;
Arr.Print();
cout << "\nTime: " << double(time2 - time1) << "s\n\n";
}
break;
case 4:
{
cout << "\n\nBUBBLE SORT\n\n";
time1 = (double)clock() / CLOCKS_PER_SEC;
Arr.Bubble_sort(N);
time2 = (double)clock() / CLOCKS_PER_SEC;
Arr.Print();
cout << "\nTime: " << double(time2 - time1) << "s\n\n";
}
case 5:
{
cout << "\n\nINSERT SORT\n\n";
time1 = (double)clock() / CLOCKS_PER_SEC;
Arr.Insert_sort(0,N-1);
time2 = (double)clock() / CLOCKS_PER_SEC;
Arr.Print();
cout << "\nTime: " << double(time2 - time1) << "s\n\n";
}
break;
case 6: break;
case 7: return 0;
default: cout << ("Wrong number!!!") << "\n\n\n";
}
cout << "\n\n\n\n\n";
} while (menu != 6);
} while (true);
system("pause");
return 0;
}