Ascending & Descending order of a list of numbers by c++:
 THEORY:

 Numbers are said to be in ascending order when they are arranged from the smallest to the largest number & called as descending when arranged from largest to smallest.
A set of data x1,x2…………,xn are said to be arranged in ascending order
if  x1<x2<x3<………..<xn.
A set of data x1,x2…………,xn are said to be arranged in descending order
if  x1>x2>x3>………..>xn.
For odd number of data, we can find single middle term whereas in case of even number of data, we will find two middle terms.
CODING:
#include<iostream.h>
#include<conio.h>
void main()
{
int a,b,i,j,n,t,k;
clrscr();
cout<<"enter n=";
cin>>n;
cout<<"input="<<endl;
for(i=0;i<n;i++)
{
cin>>a[i];
}
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
if(a[j]>a[j+1])
{
t=a[j];
a[j]=a[j+1];
a[j+1]=t;
}
}
}
cout<<"ascending order ="<<endl;
for(i=0;i<n;i++)
{
cout<<endl<<a[i];
}
k=0;
cout<<"\n data in descending=";
for(j=n-1;j>=0;j--)
{
b[j]=a[k];
k++;
}
for(j=0;j<n;j++)
{
cout<<"\n"<<b[j];
}
if(n%2==0)
{
cout<<"\n mid=\n"<<b[n/2];
cout<<"\n "<<b[(n/2)-1];
}
else
{
cout<<"\n mid=\n"<<b[(n-1)/2];
}
getch();
}

OUTPUT: