-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsorting_numbers.cpp
More file actions
49 lines (40 loc) · 1006 Bytes
/
sorting_numbers.cpp
File metadata and controls
49 lines (40 loc) · 1006 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
49
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int numbers[] = {5, 2, 8, 1, 9};
// Get the size of the array
int size = sizeof(numbers) / sizeof(numbers[0]);
// Sort the array
sort(numbers, numbers + size);
// Print the sorted array
for (int i = 0; i < size; i++) {
cout << numbers[i] << " ";
}
cout << endl;
return 0;
}
/*
int array3[20];
int track = 0;
for (int i=0; i<20; i++) {
int value = array1[i];
for (int j=0; j<20; j++) {
if (track==0) {
if (value < array1[j]) {
value = array1[j];
}
} else {
if ((value < array1[j]) && (value > array3[track])) {
value = array1[j];
}
}
}
array3[i] = value;
track++;
}
for (int i=0; i<19; i++) {
cout << array3[i] << ", ";
}
cout << array3[19] << "}" << endl;
*/