-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSortArray.cpp
More file actions
48 lines (48 loc) · 786 Bytes
/
Copy pathSortArray.cpp
File metadata and controls
48 lines (48 loc) · 786 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
//Sorts Array by increasing
void sortifyMassive(int array[], int newone[], int const Size)
{
int a = 0;
cout << "Enter " << Size << " numbers: ";
for (int i = 0; i < Size; i++)
{
cin >> array[i];
}
for (int k = 0; k < Size;)
{
for (int i = 0, j = 0; i < Size, j < Size;)
{
if (array[i] >= array[j])
{
a = array[i];
j++;
}
else
{
a = array[j];
i++;
}
if (j == Size)
{
array[i] = 0;
break;
}
if (i == Size)
{
array[j] = 0;
break;
}
}
newone[k] = a;
k++;
}
for (int i = 0; i < Size; i++)
{
cout << "New numbers: " << newone[i] << endl;
}
}
void main()
{
const int Size = 10;
int array[Size], newone[Size];
sortifyMassive(array, newone, Size);
}