Sabtu, 16 April 2016

Problem Solving and Program Design in C Halaman 419

Assalamu'alaikum wr.wb

ANALYSIS
You will need separate arrays to hold the revenue table, the unit totals (row sums)
and the hospital quarterly totals (column sums).

Algoritma:


Judul     : Summary of Hospital Revenue
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; 


Source Code:
#include <iostream>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;

int main(int argc, char** argv) {
    int i, j, max, temp;
    int data[10];
    cout<<"\t------Summary of Hospital Revenue------- "<<endl;
    cout<<"Masukan banyak data ";
    cin>>max;
    for(i=1;i<=max;i++){
        cout<<"Masukan data ke-"<<i<<" ; ";
        cin>>data[i];
        }
    cout<<"Data Awal : ";
    for(i=1;i<=max;i++){
        cout<<data[i]<<" ";
    }
    for(i=1;i<=max;i++){
        for(j=1;j<=max;j++){
        if(data[i]>data[j]){
            temp=data[i];
            data[i]=data[j];
            data[j]=temp;
        }
    }
}
    return 0;
}

Dev C++:


Output:



Untuk Problem Solving and Program Design in C Halaman 538 dapat dilihat di:
Untuk Problem Solving and Program Design in C Halaman 541 dapat dilihat di:


Wassalamu'alaikum wr. wb



 

Tidak ada komentar:

Posting Komentar