- Back to Home »
- Struktur Data »
- Responsi Struktur Data
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int data[10],a,temp,i,j;
cout<<"masukkan jumlah data = ";
cin>>a;
for(i=1;i<=a;i++){
cout<<"masukkan data ke-"<<i<<" = ";cin>>data[i];
}
for(i=1; i<=a; i++)
{
for(j=i+1; j<=a; j++)
{
if(data[i]>data[j])
{
tmp = A[i];
A[i] = A[j];
A[j] = temp;
}
}
}
for(int i=1;i<=data;i++){
cout<<dataA[i]<<" ";
}
for(int i=1;i<=data;i++){
if(data[i]%2==0){
cout<<data[i]<<" ";
}
}
system("PAUSE");
return EXIT_SUCCESS;
}