Jumat, 06 Mei 2016

Problem solving 419

Kasus :


Judul : Summary of Hospital Revenue

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;
}





1 komentar:

  1. Mystino Casino Review - Claim 125 Free Spins Today
    Mystino is a trusted online casino for real money 카지노사이트 that is available to play ミスティーノ on a wide range of devices. The casino's dafabet mobile app has plenty of

    BalasHapus