Pengurutan Oriented 1
Posted by Budi Arieyanto | Posted in Borlant C++ | Posted on 02.46
#include <iostream.h>
#include <iomanip.h>
#include <conio.h>
void main()
{
int bil[8]={5,34,32,25,75,42,22,2};
int temp;
cout<<" Data Sebelum Diurutkan : \n";
for(int i=0; i<8; i++)
{
cout<<setw(4)<<bil[i];
}
cout<<"\n\n";
for(int j=0; j<7; j++)
for(int k=0; k<7; k++)
if(bil[k]>bil[k+1])
{
temp = bil[k];
bil[k] = bil [k+1];
bil[k+1] = temp;
}
cout<<" Data Setelah diurutkan : \n";
for(int m=0; m<8; m++)
cout<<setw(4)<<bil[m];
cout<<endl;
getch();
}


Comments (0)
Posting Komentar