Guest User

Contoh Program C++ Hitung Biaya Air PDAM

a guest
Dec 5th, 2020
97
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <conio.h>
  3. using namespace std;
  4. int main () {
  5.     char nama[20];
  6.     int pakai, a, b, c, d, biaya;
  7.     cout<<"\t----------------------------------------------------------------\n";
  8.     cout<<"\t-----------------Program menghitung biaya Air------------------\n";
  9.     cout<<"\t--------------------Author : www.idnpedia.com---------------------\n";
  10.     cout<<"\t----------------------------------------------------------------\n";
  11.  
  12.     getch ();
  13.     cout << "\n..............................................";
  14.     cout << "\nMasukkan name pelanggan = "; gets (nama);
  15.     cout << "Masukkan penggunaan air (m3) = "; cin >> pakai;
  16.     //mulai sulit boskuuu
  17.                 a=10;
  18.                 b=0;
  19.                 c=0;
  20.                 d=0;
  21.    
  22.    if (pakai>30)
  23.    {            b=10; c=10; d=pakai-30;         }
  24.    else if (pakai>20)
  25.    {            b=10; c=pakai-20;   }
  26.    else if (pakai>10)
  27.    {            b=pakai-10;             }
  28.  
  29.    
  30.  
  31.    biaya= ((a*2000)+(b*3000)+(c*4000)+(d*5000)+10000);
  32.    
  33.     cout << "\n..............................................";
  34.     cout << "\nTotal tagihan anda = " <<biaya;
  35.    
  36.    
  37. }
RAW Paste Data