:::: MENU ::::
  • life isn't about getting and taking , it's about giving and being

  • Identify your passion then design your future

Jumat, 06 Mei 2016



Algoritma

Deklarasi:
I, j, max, temp integer
Deskripsi :
Max <------- input
For (i=1;i<=max;i++) then
Write(‘ Masukkan data ke- ‘I’)
for(i=1;i<=max;i++) then
write(‘data[i]’)
for(i=1;i<=max;i++) then
for(j=1;j<=max;j++) then
if(data[i]>data[j]) then
write(‘temp=data[i])
data[i] <------- data[j];
data[j] <------- temp;
C++
#include <iostream>
#include <cstdlib>
#include <conio.h>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
int a,b,max,temp;
int data[15];
cout<<"\t--------Summary of Hospital Revenue--------"<<endl;
cout<<"Masukan banyak data : ";
cin>>max;
for(a=1;a<=max;a++){
cout<<"Masukan data ke- "<<a<<"=";
cin>>data[a];
}
cout<<"Data Awal : ";
for(a=1;a<=max;a++)
{cout<<data[a]<<" ";
}
for(a=1;a<=max;a++)
{for(b=1;b<=max;b++){
if(data[a]>data[b]){
temp=data[a];
data[a]=data[b];
data[b]=temp;
}
}
}
return 0;
}
 

0 komentar:

Posting Komentar

Thank's udah mampir guys