13 Januari 2009

Bubble Sort (Turbo C++)


/* Bubble Sort
g0tch4.blogspot.com */

#include "iostream.h"
#include "stdio.h"
#include "conio.h"

void main()
{
int A[100], N;
int i,j,k;
int temp;
clrscr();
cout<<"******************************************"<<>>N;
cout<<"Input Elemen Array : "<< i="1;">>A[i];
}
cout<<"Data-Data yang Belum Diurutkan\n";
for (i=1;i<=N;i++) { cout << i="1;" j="1;">A[j+1])
{
temp = A[j];
A[j] = A[j+1];
A[j+1] = temp;
for (k=1;k<=N;k++)
{
cout<< A[k] << " ";
}
getch();
cout<< endl;
}
cout<<"Hasil Pengurutan Secara Ascending"<< endl;
for (i=1;i<=N;i++)
{
cout << A[i];
cout <<" ";
}
getch();
}

Tidak ada komentar: