#include <iostream>
#include <string>
using namespace std;
int main()
{
string raptor_prompt_variable_zzyz;
int minim;
int i;
int n;
int mini;
int temp;
int j;
int k;
int A[100];
//int[] a = new int[int+1];
raptor_prompt_variable_zzyz ="input batas";
cout << raptor_prompt_variable_zzyz << endl;
cin >> n;
i =1;
cout << "isi array = " << endl; while (!(i>n))
{
cout<<"input data "<<i<< " = ";
cin >> A[i];
i =i+1;
}
i=1;
cout <<"datanya data = ";
while (!(i>n))
{
cout << A[i]<<" " ; i =i+1;
}
j =1;
cout<<endl;
while (!(j>n))
{
minim =j;
mini =A[j];
k =j+1;
while (!(k>n))
{
if (mini>A[k])
{
minim =k;
mini =A[k];
}
else
{
}
k =k+1;
}
temp =A[j];
A[j] = A[minim];
A[minim] = temp;
j =j+1;
}
i =1;
cout << "setelah diurutkan = "; while (!(i>n))
{
cout << A[i] <<" "; i =i+1;
}
cout<<endl;
system("pause");
return 0;
}
Tidak ada komentar:
Posting Komentar