Sortare prin interschimbare
#include<iostream>
using namespace std;
int main()
{int a[100],n,i,j,aux;
cout<<"n=";cin>>n;
for(i=0;i<n;i++){cout<<"a["<<i<<"]=";cin>>a[i];}
for(i=0;i<n;i++)
for(j=i+1;j<n;j++)
if(a[i]>a[j])
{aux=a[i];
a[i]=a[j];
a[j]=aux;}
for(i=0;i<n;i++)cout<<a[i]<<endl;
}