The-Pinguin

Reference Information About The Technology

Subscribe
Add to Technorati Favourites
Add to del.icio.us

Suported by :

Bisnis Internet | Bisnis Online | Uang dari Internet |  Duit gratis | komisi 80% CO.CC:Free Domain
Wednesday, May 20, 2009

Source Code Buble sorting di C++

Posted by Oki Arifin


#include <stdio.h>
#include <conio.h>

void main(){

int i,j,iMin;
int n, Urut;
int Tmp;
int Arr[50];

printf("Banyak data: ");
scanf("%i",&n);


Urut =1;
for(i=0;i<n;i++){
printf("masukan data ke %i : ",i+1);
scanf("%i",&Arr[i]);
}
for (i=1;i<n;i++){
for(j=0; j<n-1;j++){
if(Arr[j]>Arr[j+1]){
Tmp = Arr[j];
Arr[j] = Arr[j+1];
Arr[j+1] = Tmp;
}
}
Urut++;
}
clrscr();
printf("urutan yang benar: ");
for(i=0;i<n;i++){
printf("%i ",Arr[i]);
}
printf("\n\npress any key to continue...");
getch();
}

Setelah di jalankan hasil printscreennya :





Artikel Terkait:

0 comments:

Post a Comment