Insertion Sort in c++
#include < iostream.h >
#include < conio.h >
void sort(int * a) {
for (int j = 2; j < 10; j++) {
for (int k = 0; k < j; k++) {
if (a[j] < a[k]) {
int temp = a[k];
a[k] = a[j];
a[j] = temp;
}
}
}
for (int i = 0; i < 10; i++) {
cout << a[i] << "\n";
}
}
void main() {
clrscr();
int a[] = {
1, 4, 6, 8, 0, 9, 7, 5, 2, 3};
sort(a);
}
Insertion Sort in c++