document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. #include <iostream>
  2. #include <conio>
  3. #include <iomanip>
  4.  
  5. main(){
  6. int A[5];
  7. int x,j,k,temp;
  8.  
  9. cout<<"Masukkan 5 data berupa angka\\n";
  10. for(x=0;x<5;x++){
  11. cout<<"data ke-"<<x+1<<" :";cin>>A[x];}
  12.  
  13. cout<<"\\nSebelum urut :\\n";
  14. for (x=0;x<5;x++){
  15.     cout<<setw(3)<<A[x];}
  16.  
  17. for(j=4;j>0;j--){
  18.         for(k=0;k<j;k++){
  19.             if(A[k]>A[k+1]){
  20.                 temp=A[k+1];
  21.                 A[k+1]=A[k];
  22.                 A[k]=temp;
  23.         }
  24.     }
  25. }
  26. cout<<"\\n\\nsetelah urut :"<<endl;
  27. for (x=0;x<5;x++){
  28.     cout<<setw(3)<<A[x];}
  29. getch();}
');