-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSe_Sort.cpp
More file actions
48 lines (37 loc) · 765 Bytes
/
Se_Sort.cpp
File metadata and controls
48 lines (37 loc) · 765 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
#include <iostream>
using namespace std;
void Selection_Sort (int A[], int n)
{
int i, j, index_min, temp;
for (i = 0; i < n-i-1; i++)
{
index_min = i;
for (j = i + 1; j < n; j++)
{
if (A[j] < A[index_min])
{
index_min = j;
}
}
if (index_min != i)
{
temp = A[i];
A[i] = A[index_min];
A[index_min] = temp;
}
}
}
int main()
{
int B[5], i;
cout << "Enter the Array input: ";
for (int i = 0; i < 5; i++)
{
cin >> B[i];
}
//int m;
// cout << "Enter the 5 Array number: ";
//cin >> m;
Selection_Sort (B,5);
return 0;
}