Insertion Sorting

#include<iostream.h>
#include<conio.h>


void InsertionSort(int a[],int n)
{
    int i,j,t;
    for(i=1;i<n;i++)
        {
            t=a[i];
            j=i-1;
            while(t<a[j]&&j>=0)
                {
                a[j+1]=a[j];
                j--;
                }
            a[j+1]=t;
        }
}
void main()
{
clrscr();
int a[50],i,n,d,pos;
cout<<"Enter the number of elements ";
cin>>n;
cout<<"Enter the elements";
for(i=0;i<n;i++)
    {
    cin>>a[i];
    }
InsertionSort(a,n);
cout<<"Ascending Order";
for(i=0;i<n;i++)
    {
    cout<<a[i]<<",";
    }
getch();
}