I have a programming for heapsorting put it not work good
plz help my and chack why not work prefact .
#include<iostream.h>
#include<conio.h>
void in_arr();
void out_arr();
void buildheap();
void adjustheap(int m);
int A[100];
int n,m,i,j,k,item,el,s,done;

//************************************************** ********************
main()
{
m=n;
in_arr();
getch();
buildheap();
out_arr();
getch();
adjustheap(m);
out_arr();
cout<<"\n\n\n End of the program ";
}
//************************************************** ********************
void in_arr()
{
cout<<"\n Enter the size of the array :";
cin>>n;
cout<<"\n Enter all the elements :\n";
for(i=1;i<=n;i++)
cin>>A[i];
cout<<endl;
}
//************************************************** *********************
void out_arr()
{
cout<<"\n The elements are :\n";
for(i=1;i<=n;i++)
cout<<A[i]<<" ";
cout<<endl;
}
//************************************************** ********************
void buildheap()
{

for(k=2;k<=n;k++)
{
i=k;
j=i/2;
while((i!=1)&&(A[i]<A[j]))
{
item=A[j];
A[j]=A[i];
A[i]=item;
i=j;
if(i>j)
j=i/2;
}}}
//************************************************** ********************
void adjustheap(int m)
{
el=A[i];
done=0;
i=1;
s=2;
while((s<m)&&(done==0))
{
if((s+1)<m)
{
if(A[s+1]<A[s])
s=s+1;
}
if(el>=A[s])
done=1;
else
{
A[i]=A[s];
A[s]=el;
i=s;
s=s*i;

}}}