http://super-bee.blogspot.com/2012/06/membuat-tab-menu-di-sidebar-blog.html
http://blognyaagumganugrah.blogspot.com
http:jkw1.wordpress.com
Tab 2.1
Tab 2.2
Tab 2.3
Tab 2.1
Tab 2.2
Tab 2.3
Tab 3.1
Tab 3.2
Tab 3.3
Widget edited by cara membuat blog

Jumat, 21 Desember 2012

Bubble Sort





#include "stdio.h"
#include "conio.h"
#define n 7

void Tukar(int &a, int &b); //header function pass by refrence
void View(int arr[]); //header function pass by value

void main()
{
int A[n] = {15,10,7,22,17,5,12};
int X, I, K;
printf("Sebelum di-sort\n");
View(A);

for (I=0;I<=n-1;I++) { for (int K=n-1;K>=I;K--)
if (A[K-1]> A[K])
Tukar(A[K],A[K-1]); //fungsi tukar

View(A);
}

printf("Sesudah di-sort\n");
View(A);

getch();
}

void Tukar(int &a, int &b)
{
int X;
X = a;
a = b;
b = X;
}

void View(int arr[])
{
for (int I=0; I <= n-1; I++)
printf("%3i", arr[I]);
printf("\n");
}

0 komentar:

Posting Komentar

older post Home