Alhamdulillah, All praises only to Allah ta'ala. Sholawat and Sallam to prophet Mohammad -shallallahu alaihi wa sallam-.
Okay in this section i will explain to you about how to solve "E-Book (Problem Solving And Program Design in C) = Summary Of Hospital Revenue (page 419)".
Let's begin...
Analysis :
You will need separate arrays to hold the revenue table, the unit totals (row sums)
and the hospital quarterly totals (column sums).
Algorithm :
Declaration :
I, j, max, temp : integer
Description :
Max <--- Input
for (i=1;i<=max;i++)then
write("Masukkan Data Ke- 'I'")
for(i=1;i<=max;i++)then
write('data[1]')
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 with Code::Blocks
#include <iostream> #include <cstdlib> using namespace std; int main(int argc, char** argv) { int i, j, max, temp; int data[10]; cout<<"\t\t\t++++ Summary of Hospital Revenue ++++"<<endl<<endl; cout<<"Masukkan Banyak Data : "; cin>>max; for(i=1;i<=max;i++){ cout<<"\nMasukkan Data Ke-"<<i<<" ; "; cin>>data[i]; } cout<<"\nData 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; } |
And this is the output
Okey.. thanks for visiting my blogs..
Barakallahu fiykum
Wassalamualaikum warahmatullahi wabarakatuh
0 komentar:
Posting Komentar