-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlists.cpp
More file actions
74 lines (66 loc) · 1.82 KB
/
Copy pathlists.cpp
File metadata and controls
74 lines (66 loc) · 1.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
#include <iostream>
#include <stdio.h>
#include <cstdlib>
#include <time.h>
#include "listsModule/sort_choose.cpp"
#include "listsModule/most.cpp"
#include "listsModule/srednee_znach.cpp"
#include "listsModule/two_less.cpp"
#include "listsModule/delete_minus.cpp"
#include "listsModule/bubble.cpp"
int massivLength = 0;
int lists()
{ const int BUBBLE = 1, DELETEMINUS = 2, MOST = 3, SORTCHOOSE = 4, SREDNEEZNACH = 5, TWOLESS = 6, EXIT = 0;
char random = 'y';
bool exit = false;
int numb = 0, choice = 0;
while (exit == false){
printf("\nEnter list length: ");
scanf("%d", &massivLength);
int massiv[massivLength] = {};
printf("Randomize? (y/n)");
scanf(" %c", &random);
if (random != 'y')
{
for (int i = 0; i < massivLength; i++)
{
printf("Enter %d element of list: \n", i);
scanf("%d", &numb);
massiv[i] = numb;
};
}
else
{
for (int i = 0; i < massivLength; i++)
{
massiv[i] = rand() % 2000 - 999;
};
};
printf(" 1 - bubble sort\n 2 - delete minuses\n 3 - most often\n 4 - choose sort\n 5 - average znach\n 6 - two less nums\n 0 - exit\n");
scanf("%d",&choice);
switch (choice){
case BUBBLE:
bubble(massiv, massivLength);
break;
case DELETEMINUS:
delete_minus(massiv, massivLength);
break;
case MOST:
most(massiv, massivLength);;
break;
case SORTCHOOSE:
sort_choose(massiv, massivLength);
break;
case SREDNEEZNACH:
srednee_znach(massiv, massivLength);
break;
case TWOLESS:
two_less(massiv, massivLength);
break;
case EXIT:
exit = true;
break;
};
};
return 0;
};