SHARE
TWEET

Untitled

a guest Dec 11th, 2019 101 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "iostream"
  2. #include <fstream>
  3. using namespace std;
  4.  
  5. int main() {
  6.   int i=1;
  7.   int jenisLayanan,tipeKendaraan,merManual,merMatic,kendaraan,b,a,hari;
  8.   int x=25000;
  9.   string nama,yesorno;
  10.   string noPengenal;
  11.   int jenisPengenal;
  12.   string array[]={"none","avanza","ayla","rush","xenia","xpander"};
  13.   string merkMatic[]={"none","Mio","Vario","Beat","Nmax"};
  14.   string merkManual[]={"none","Supra","astrea","jupiter"};
  15.   string menuPaket[]={"","Rental Kendaraan","Paket Tour and travel"};
  16.   string tipeMobil[]={"","Manual","Auto"};
  17.   string tipeMotor[]={"","Manual","Matic"};
  18.   string jenisKendaraan[]={"","Mobil","Motor"};
  19.   start:
  20.   cout<<"selamat datang di rian group"<<endl;
  21.   cout<<"silahkan pilih layanan jasa kami"<<endl;
  22. //menu pertama
  23.   for (int i = 1; i <= 2 ; i++) {
  24.     cout<<i<<". "<<menuPaket[i]<<endl;
  25.   }
  26.   cout << "silahkan pilih :" << '\n';
  27.   cin>> jenisLayanan;
  28.   switch (jenisLayanan) {
  29.     case 1 : //Rental
  30.     cout<<"pilih jenis kendaraan"<<endl;
  31.     for (int i = 1; i <= 2 ; i++) {
  32.       cout<<i<<". "<<jenisKendaraan[i]<<endl;
  33.     }//mobil atau motor
  34.     cout<<"Masukan Pilihan : ";
  35.     cin>>kendaraan;
  36.     switch (kendaraan) {
  37.       case 1://mobil
  38.       cout<<"Pilih Tipe Kendaraan"<<endl;
  39.       for (int i = 1; i <= 2 ; i++) {
  40.         cout<<i<<". "<<tipeMobil[i]<<endl;
  41.       }
  42.       cout<<"Masukan Pilihan anda : ";
  43.       cin>>tipeKendaraan;
  44.       switch (tipeKendaraan) {
  45.         case 1:
  46.         cout<<"Pilih Merek Mobil"<<endl;
  47.         for (int i = 1; i <= 5 ; i++) {
  48.           cout<<i<<". "<<array[i]<<endl;
  49.         }
  50.         cout<<"pilih merek mobil";
  51.         cin>>merManual;
  52.         cout << "Masukan jumlah hari : ";
  53.         cin>>hari;
  54.  
  55.         cout <<"jenis layanan : " <<menuPaket[jenisLayanan]<<endl;
  56.         cout <<"jenis kendaraan : " <<jenisKendaraan[kendaraan]<<endl;
  57.         cout <<"merk kendaraan :"  <<array[merManual]<<endl;
  58.         cout <<"tipe kendaraan :"  <<tipeMobil[tipeKendaraan]<<endl;
  59.         cout << "harga sewa kendaraan" << hari*x*10<<endl;
  60.         break;
  61.         case 2:
  62.         cout<<"Pilih Merek Mobil"<<endl;
  63.         for (int i = 1; i <= 5 ; i++) {
  64.           cout<<i<<". "<<array[i]<<endl;
  65.         }
  66.         cout<<"pilih merek mobil";
  67.         cin>>merManual;
  68.         cout << "Masukan jumlah hari : ";
  69.         cin>>hari;
  70.  
  71.         cout <<"jenis layanan : " <<menuPaket[jenisLayanan]<<endl;
  72.         cout <<"jenis kendaraan : " <<jenisKendaraan[kendaraan]<<endl;
  73.         cout <<"merk kendaraan :"  <<array[merManual]<<endl;
  74.         cout <<"tipe kendaraan :"  <<tipeMobil[tipeKendaraan]<<endl;
  75.         cout << "harga sewa kendaraan" << hari*x*10<<endl;
  76.         cout << "lanjutkan penyewaan ( Y / N ) : ";
  77.         break;
  78.       }
  79.       break;
  80.       case 2://motor
  81.       cout << "ini blok motor";
  82.       cout<<"Pilih Jenis Motor"<<endl;
  83.       for (int i = 1; i <= 2 ; i++) {
  84.         cout<<i<<". "<<tipeMotor[i]<<endl;
  85.       }
  86.       cout<<"Masukan Pilihan : ";
  87.       cin>>tipeKendaraan;
  88.       switch (tipeKendaraan) {
  89.  
  90.         case 1:
  91.         cout<<"Pilih Merek Motor"<<endl;
  92.         for (int i = 1; i <= 3 ; i++) {
  93.           cout<<i<<". "<<merkManual[i]<<endl;
  94.         }
  95.           cout<<"Masukan Pilihan : ";
  96.           cin>>merManual;
  97.           break;
  98.  
  99.       case 2:
  100.       cout<<"Pilih Merek Motor"<<endl;
  101.       for (int i = 1; i <= 4 ; i++) {
  102.         cout<<i<<". "<<merkMatic[i]<<endl;
  103.       }
  104.         cout<<"Masukan Pilihan : ";
  105.         cin>>merMatic;
  106.       break;
  107.       }
  108.       cout << "Masukan jumlah hari : ";
  109.       cin>>hari;
  110.       cout <<"jenis layanan : " <<menuPaket[jenisLayanan]<<endl;
  111.       cout <<"jenis kendaraan : " <<jenisKendaraan[kendaraan]<<endl;
  112.       cout << merManual << '\n';
  113.       if (merManual>0){
  114.         cout<<"merk kendaraan" <<merkManual[merManual]<<endl;
  115.       }else{
  116.         cout<<"merk kendaraan" <<merkMatic[merMatic]<<endl;
  117.       }
  118.       cout <<"tipe kendaraan :"  <<tipeMotor[tipeKendaraan]<<endl;
  119.       cout << "harga sewa kendaraan" << hari*x<<endl;
  120.  
  121.       break;
  122.     }
  123.     yorn:
  124.     cout << "lanjutkan penyewaan ( Y / N ) : ";
  125.     cin>>yesorno;
  126.     if(yesorno=="y"){
  127.       cout <<"silakan isi biodata anda : "<<endl;
  128.       cout<<"nama : ";
  129.       cin>>nama;
  130.       pengenal:
  131.       cout <<"Jenis tanda Pengenal Anda : "<<endl;
  132.       cout<<"1. ktp"<<endl;
  133.       cout<<"2. ktm"<<endl;
  134.  
  135.       cout<<"masukan pilihan anda (1/2): ";
  136.       cin>>jenisPengenal;
  137.       if(jenisPengenal ==1 || jenisPengenal ==2){
  138.       cout<<"nomer tanda pengenal : ";
  139.       cin>>noPengenal;
  140.       cout<<"data penyewaan telah diinput";
  141.       ofstream myfile (noPengenal+".txt");
  142.       if (myfile.is_open())
  143.       {
  144.         myfile << "nama peminjam :"<<nama<<endl;
  145.         myfile << "no ktp :"<<noPengenal<<endl;
  146.         if(kendaraan==1){
  147.           myfile <<"jenis layanan : " <<menuPaket[jenisLayanan]<<endl;
  148.           myfile <<"jenis kendaraan : " <<jenisKendaraan[kendaraan]<<endl;
  149.           myfile <<"merk kendaraan :"  <<array[merManual]<<endl;
  150.           myfile <<"tipe kendaraan :"  <<tipeMobil[tipeKendaraan]<<endl;
  151.           myfile << "harga sewa kendaraan" << hari*x*10<<endl;
  152.         }else{
  153.           myfile <<"jenis layanan : " <<menuPaket[jenisLayanan]<<endl;
  154.           myfile <<"jenis kendaraan : " <<jenisKendaraan[kendaraan]<<endl;
  155.           if (merManual>0){
  156.             myfile<<"merk kendaraan" <<merkManual[merManual]<<endl;
  157.           }else{
  158.             myfile<<"merk kendaraan" <<merkMatic[merMatic]<<endl;
  159.           }
  160.           myfile <<"tipe kendaraan :"  <<tipeMotor[tipeKendaraan]<<endl;
  161.           myfile << "harga sewa kendaraan" << hari*x<<endl;
  162.         }
  163.         myfile.close();
  164.       }
  165.       else cout << "Unable to open file";
  166.  
  167.     }else{
  168.       cout<<"pilihan tidak dikenali ulangi :";
  169.       goto pengenal;
  170.     }
  171.     }else if (yesorno=="n"){
  172.       cout<<"trimakasih telah berkunjung";
  173.       goto start;
  174.     }else
  175.     goto yorn;
  176.     break;
  177.     case 2:
  178.     cout<<"travel";
  179.     break;
  180.   }
  181. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top