-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
76 lines (62 loc) · 2.04 KB
/
main.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
//
// main.cpp
// Projekt2_PAMSI
//
// Created by Michał on 26.03.2018.
// Copyright © 2018 Michał. All rights reserved.
#include <iostream>
#include "MergeSort.hpp"
#include "QuickSort.hpp"
#include "HeapSort.hpp"
#include "test_functions.hpp"
using namespace std;
int main(void) {
int number_of_arrays = 100;
int size_of_arrays = 10000;
int **arr = create_array(number_of_arrays,size_of_arrays);
int choice=0;
cout<<endl<<"Number of array's: "<<number_of_arrays<<endl;
cout<<"Size of array's: "<<size_of_arrays<<endl;
cout<<endl<<"-----Program functions:-----"<<endl;
cout<<"1.Change the size of the array's"<<endl;
cout<<"2.Mergesort test"<<endl;
cout<<"3.Quicksort test"<<endl;
cout<<"4.Heapsort test"<<endl;
cout<<"9.Exit"<<endl;
while(1){
cout<<"(Functions->press 8) > ";
cin>>choice;
if(choice==9){
cout<<"Program ended with exit code 0"<<endl;
break;
}
switch(choice){
case 1:
cout<<"Size of array's: ";
cin>>size_of_arrays;
break;
case 2:
MergeSort_test(arr,number_of_arrays,size_of_arrays);
break;
case 3:
QuickSort_test(arr,number_of_arrays,size_of_arrays);
break;
case 4:
HeapSort_test(arr,number_of_arrays,size_of_arrays);
break;
case 8:
cout<<endl<<"Number of array's: "<<number_of_arrays<<endl;
cout<<"Size of array's: "<<size_of_arrays<<endl;
cout<<endl<<"-----Program functions:-----"<<endl;
cout<<"1.Change the size of the array's"<<endl;
cout<<"2.Mergesort test"<<endl;
cout<<"3.Quicksort test"<<endl;
cout<<"4.Heapsort test"<<endl;
cout<<"9.Exit"<<endl;
break;
}
}
free(arr); //free memory
arr = NULL;
return 0;
}