/*
 * CS2310 Lab06.Q2 insertion sort 
 */

#include <iostream>

using namespace std;

/*
 * 
 */
int main() {
    //arr[] is the input array for sort, and n is the numeber for binary search
    int size=6, arr[6];
    cout << "Enter the element in the array:" << endl;
    for(int i=0; i < size; i++){
        cin >> arr[i];
    }
    for (int i=0; i < size; i++){
        int temp = arr[i];
        int j;
        for (j = i - 1; j >= 0 && arr[j] > temp; j--) {
            arr[j + 1] = arr[j];
        }
        arr[j + 1] = temp;
    }
    cout << "The sorted array is:"<< endl << arr[0];
    for (int i =1; i<size; i++){
        cout << ", " << arr[i];
    }
    cout << endl;
    return 0;
}


