Contoh program mengurutkan angka C++

Contoh program mengurutkan angka C++

#include<iostream.h>
#include<conio.h>
void main(){ clrscr();
                int h[5]; int i,j,k; int bil;
                cout<<"Program mengurutkan angka"<<endl;
                                for(i=0; i<5; i++){
                                cout<<"Masukkan angka ke "<<(i+1)<<" : "; cin>>h[i];}
                                cout<<"============================================"<<endl;
                                cout<<"Data sebelum di urutkan : "<<endl;
                                for(i=0; i<5; i++){
                                cout<<h[i]<<" ";}
                                cout<<endl;
                                for(i=0; i<6; i++){
                                                for(j=i+1;j<5;j++){
                                                if(h[i]>h[j]){k=h[i];h[i]=h[j];h[j]=k;}}}
                                cout<<"============================================"<<endl;
                                cout<<"Data setelah di urutkan : "<<endl;
                                for(i=0;i<5;i++){
                                                cout<<h[i]<<" ";}
                                                cout<<endl;
                                cout<<"============================================"<<endl;
                                cout<<"Masukkan nilai yang akan di cari : ";cin>>bil;
                                for(i=0;i<5;i++){
                                                if(h[i]==bil){
                                                cout<<"Nilai yang di cari terdapat pada indek ke :"<<i+1;cout<<endl<<endl;
                                                break;}}
                getch();
                }

screenshotnya :