Advertisement
xathrya

Untitled

Oct 22nd, 2013
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.51 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     char kelas, lagi;
  8.     unsigned long ubay, kmb;
  9.     string kopes, napes;
  10.     unsigned long harga=0,tobay;
  11.     int jutik;
  12.     awal:
  13.     cout<<"PROGRAM TIKET PESAWAT"<<endl;
  14.     cout<<"JAKARTA-MALAYSIA"<<endl;
  15.  
  16.     cout<<"--------------------------------------\n";
  17.     cout<<"masukan kode pesawat [MPT/GRD/BTV] :";cin>>kopes;
  18.     cout<<"kelas pesawat\n"
  19.     <<"1. Excekutif\n"
  20.     <<"2. Bisnis\n"
  21.     <<"3. Ekonomi\n";
  22.     cout<<"pilih kelas [1/2/3]: ";  cin>>kelas;
  23.     cout<<endl;
  24.    
  25.     for (int ijk = 0; ijk < kopes.length(); ijk++) {
  26.         kopes[ijk] = tolower(kopes[ijk]);
  27.     }
  28.    
  29.     if (kopes=="mpt") {
  30.         napes="MERPATI";
  31.         if(kelas=='1') {
  32.             harga=1500000;
  33.         } else if(kelas=='2') {
  34.             harga=900000;
  35.         } else if(kelas=='3') {
  36.             harga=500000;
  37.         }
  38.     }
  39.  
  40.     if (kopes=="grd") {
  41.         napes="GARUDA";
  42.         if(kelas=='1'){
  43.             harga=1200000;
  44.         } else if(kelas=='2') {
  45.             harga=800000;
  46.         } else if(kelas=='3') {
  47.             harga=400000;
  48.         }
  49.     }
  50.     if (kopes=="btv") {
  51.         napes="BATAVIA";
  52.         if(kelas=='1'){
  53.             harga=1000000;
  54.         } else if(kelas=='2') {
  55.             harga=700000;
  56.         } else if(kelas=='3') {
  57.             harga=300000;
  58.         }
  59.     }
  60.  
  61.     cout<<"nama pesawat: " << napes << endl;
  62.     cout<<"harga tiket:  " << harga << endl;
  63.     cout<<"masukan jumlah tiket : "; cin>>jutik;
  64.     tobay= harga * jutik;
  65.     cout<<"total bayar\t:"<<tobay<<endl;
  66.     cout<<"uang bayar\t :";cin>>ubay;
  67.     kmb=ubay-tobay;
  68.     cout<<"kembalian\t :"<<kmb<<endl;
  69.  
  70.     cout<<"input data lagi [Y/T]:";cin>>lagi;
  71.  
  72.     if(lagi=='Y'|| lagi=='y')
  73.         goto awal;
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement