Membuat Program Penyewaan Kios Dengan C++
Program ini dibuat Oleh Maryanti Nurjanah Follow Juga Akun Instagramnya di @marilhaphapBaik, langsung saja ke program nya. Hal penting yang Perlu diketahui, kamu harus memahami setiap syntax supaya tidak bingung jika terjadi error.
1. Syntax Program
#include<iostream> #include<conio.h> #include<string> #include<windows.h> #include<time.h> #include <stdio.h> #include <stdlib.h> using namespace std; void gotoxy ( int x, int y){ COORD coord; coord.X = x; coord.Y = y; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),coord); } void delay(unsigned int msecond) { clock_t goal=msecond+clock(); while(goal>clock()); } int main(int argc, char** argv) { system ("color 4F"); { struct kya { int ip,d,biaya,tb,lp; char np[50],jk[10],jp[20],al[20],jw,nohp[20]; int pa,pb,pc,pd,pe,j,h; int ha,hb,hc,hd,he; int ppn,jb,b,k; int dp1,pk,dp,lagi,a,n; }; int a=-1; kya ka[100]; char jawab, lagi,lh, pass[6],pnp[20],pjp[10],pjk[20],us[20]; int n, t , input, menu,ma,pkd,mn,m,kode,kd,dpp; int pip,plp,maid,biaya,d,tb; {aw: { system("cls"); int h,i; for(h=1;h<20;h++) { delay(120); gotoxy(h-1,0);cout<<' '; gotoxy(h,0);cout<<" SELAMAT DATANG DI PENYEWAAN KIOS MALL K.E.M "; cout<<endl;} { user: string pass=""; char ch,us[20]; system("cls"); cout<<"======================================"<<endl; cout<<"\t SELAMAT DATANG DI MALL K.E.M "<<endl; cout<<"======================================"<<endl; cout<<"Username : ";cin>>us; cout<<"Password : "; ch=_getch(); while (ch != 13 ) { pass.push_back(ch); cout<<'*'; ch=_getch(); } if (pass== "mar123") { goto pk; } else { goto user; }} { pk: system("cls"); cout<<"================================"<<endl; cout<<"| PILIHAN PENYEWAAN |"<<endl; cout<<"|------------------------------|"<<endl; cout<<"| 1. PENYEWAAN KIOS DIMALL |"<<endl; cout<<"| 2. DAFTAR NAMA PENYEWA |"<<endl; cout<<"| 3. LOGOUT |"<<endl; cout<<"================================"<<endl; cout<<"Pilih Menu 1/2/3 : ";cin>>pkd; switch (pkd) { //kurung case pkd { // kurung case 1 case 1 : cas1: system("cls"); cout<<"================================"<<endl; cout<<"| PENYEWAAN KIOS DI MALL |"<<endl; cout<<"|------------------------------|"<<endl; cout<<"| 1. DAFTAR KIOS YG ADA |"<<endl; cout<<"| 2. DAFTAR PENYEWAAN |"<<endl; cout<<"================================"<<endl; cout<<"Silahkan pilih menu [1/2] = ";cin>>kd; if (kd==1) {system("cls"); jky: system("cls"); cout<<"======================================="<<endl; cout<<"| Jenis Kios | Ukuran | Fasilitas |"<<endl; cout<<"======================================="<<endl; cout<<"| Konter | 2 X 3 | Etalase |"<<endl; cout<<"| Fastfood | 4 X 4 | Wastafel |"<<endl; cout<<"| Busana | 3 X 3 | Cermin Besar |"<<endl; cout<<"|======================================"<<endl; cout<<"Ingin Kembali ke Menu Awal ? (y/t) : ";cin>>lagi; if (lagi=='y' || lagi=='Y') { goto pk; } else if (lagi=='t' || lagi=='T') { goto jky; } else { cout<<"Kode yg anda masukkan salah"; goto pk; } } if (kd==2) {//kurung awal kd 2 {system("cls"); dp1: a++; cout<<"=========================="<<endl; cout<<"| KODE JENIS KIOS |"<<endl; cout<<"--------------------------"<<endl; cout<<"| Kode | Jenis Kios |"<<endl; cout<<"--------------------------"<<endl; cout<<"| 1 | Kios Konter |"<<endl; cout<<"| 2 | Kios Fastfood |"<<endl; cout<<"| 3 | Kios Busana |"<<endl; cout<<"=========================="; system("cls"); cout<<"=================================="<<endl; cout<<"| DAFTAR PENYEWAAN |"<<endl; cout<<"----------------------------------"<<endl; cout<<"Id Penyewa : ";cin>>ka[a].ip; cout<<"Nama Penyewa : ";cin>>ka[a].np; cout<<"Alamat Penyewa : jl.";cin>>ka[a].al; cout<<"No Hp Penyewa : ";cin>>ka[a].nohp; cout<<"Jenis Kios : ";cin>>ka[a].jk; cout<<"Lama Penyewaan (bulan): ";cin>>ka[a].lp; cout<<"Jenis Pembayaran : ";cin>>ka[a].jp; cout<<"=================================="<<endl; } cout<<"Apakah ada penyewaan lagi ? (y/t) : ";cin>>lagi; if (lagi=='y' || lagi=='Y') { goto dp1; } else if (lagi=='t' || lagi=='T') { goto pk; } else { cout<<"Kode yg anda masukkan salah"; goto pk; } } //kurung akhir kd2 else { cout<<"kode anda salah"<<endl; } break;} case 2 : { //kurung awal case2 cas2: system("cls"); cout<<"============================"<<endl; cout<<"| DAFTAR PENYEWAAN |"<<endl; cout<<"|--------------------------|"<<endl; cout<<"| 1. DAFTAR PENYEWA |"<<endl; cout<<"| 2. PEMBAYARAN |"<<endl; cout<<"============================"<<endl; cout<<"Silahkan pilih menu [1/2] = ";cin>>dpp; if (dpp==1) { dpy: system("cls"); cout<<"=========================================="<<endl; cout<<"| Daftar Penyewa |"<<endl; cout<<"=========================================="<<endl; for (n=0;n<=a;n++) { cout<<"No. : "<<(n+1)<<endl; cout<<"Id Penyewa : "<<ka[n].ip<<endl; cout<<"Nama Penyewa : "<<ka[n].np<<endl; cout<<"========================================"<<endl; } { dl: cout<<"Apakah ingin melihat data lengkap ? (y/t) ";cin>>lh; if ( lh=='Y' || lh=='y') { noid: cout<<"Masukkan Id Penyewa : ";cin>>maid; for (n=0;n<=a;n++) { if (maid==ka[n].ip) { system("cls"); cout<<"===================================="<<endl; cout<<"| Data Lengkap Penyewa |"<<endl; cout<<"===================================="<<endl; cout<<"Id Penyewa : "<<ka[n].ip<<endl; cout<<"Nama Penyewa : "<<ka[n].np<<endl; cout<<"Alamat Penyewa : "<<ka[n].al<<endl; cout<<"No Hp Penyewa : "<<ka[n].nohp<<endl; cout<<"Jenis Kios : "<<ka[n].jk<<endl; cout<<"Lama Penyewaan (bulan): "<<ka[n].lp<<endl; cout<<"Jenis Pembayaran : "<<ka[n].jp<<endl; cout<<"=============================================\n"; t2: cout<<"Ingin kembali kedaftar penyewa ? (y/t) : ";cin>>jawab; if (jawab=='y' || jawab=='Y') { goto dpy; } else if (jawab=='t' || jawab=='T') { goto pk; } else { cout<<"Kode Anda Salah"<<endl; goto t2; } } } cout<<"Id Pengunjung Salah"; goto noid; } else if (jawab=='t' || jawab=='T') { goto pk; } else { cout<<"kode anda salah"; goto t2; } getch(); } } else if (dpp==2) { cout<<"Masukkan Id Penyewa : ";cin>>maid; for (n=0;n<=a;n++) { if (maid==ka[n].ip) { system("cls"); cout<<"=================================="<<endl; cout<<"| DAFTAR PEMBAYARAN |"<<endl; cout<<"----------------------------------"<<endl; { { cout<<"Id Penyewa : "<<ka[n].ip<<endl; cout<<"Nama Penyewa : "<<ka[n].np<<endl; cout<<"Alamat Penyewa : "<<ka[n].al<<endl; cout<<"No Hp Penyewa : "<<ka[n].nohp<<endl; cout<<"Jenis Kios : "<<ka[n].jk<<endl; cout<<"Lama Penyewaan (bulan): "<<ka[n].lp<<endl; cout<<"Jenis Pembayaran : "<<ka[n].jp<<endl; cout<<"=================================="<<endl; } if (ka[n].lp<6 ) { system("cls"); ka[n].biaya=200000; ka[n].d=0.02*ka[n].biaya; ka[n].tb=biaya-ka[n].d; cout<<"=================================="<<endl; cout<<"| DAFTAR PEMBAYARAN |"<<endl; cout<<"----------------------------------"<<endl; cout<<"Id Penyewa : "<<ka[n].ip<<endl; cout<<"Nama Penyewa : "<<ka[n].np<<endl; cout<<"Alamat Penyewa : "<<ka[n].al<<endl; cout<<"No Hp Penyewa : "<<ka[n].nohp<<endl; cout<<"Jenis Kios : "<<ka[n].jk<<endl; cout<<"Lama Penyewaan (bulan): "<<ka[n].lp<<endl; cout<<"Jenis Pembayaran : "<<ka[n].jp<<endl; cout<<"Biaya : "<<ka[n].biaya<<endl; cout<<"Diskon : "<<ka[n].d<<endl; cout<<"Total Bayar : "<<ka[n].tb<<endl; cout<<"=================================="<<endl; } else if (ka[n].lp>=6 && ka[n].lp<12 ) { system("cls"); ka[n].biaya=250000; ka[n].d = 0.04 * ka[n].biaya; ka[n].tb = ka[n].biaya - ka[n].d; cout<<"=================================="<<endl; cout<<"| DAFTAR PEMBAYARAN |"<<endl; cout<<"----------------------------------"<<endl; cout<<"Id Penyewa : "<<ka[n].ip<<endl; cout<<"Nama Penyewa : "<<ka[n].np<<endl; cout<<"Alamat Penyewa : "<<ka[n].al<<endl; cout<<"No Hp Penyewa : "<<ka[n].nohp<<endl; cout<<"Jenis Kios : "<<ka[n].jk<<endl; cout<<"Lama Penyewaan (bulan): "<<ka[n].lp<<endl; cout<<"Jenis Pembayaran : "<<ka[n].jp<<endl; cout<<"Biaya : "<<ka[n].biaya<<endl; cout<<"Diskon : "<<ka[n].d<<endl; cout<<"Total Bayar : "<<ka[n].tb<<endl; cout<<"=================================="<<endl; } else if (ka[n].lp >= 12 && ka[n].lp < 24 ) { system("cls"); ka[n].biaya=300000; ka[n].d=0.05*ka[n].biaya; ka[n].tb= ka[n].biaya-ka[n].d; cout<<"=================================="<<endl; cout<<"| DAFTAR PEMBAYARAN |"<<endl; cout<<"----------------------------------"<<endl; cout<<"Id Penyewa : "<<ka[n].ip<<endl; cout<<"Nama Penyewa : "<<ka[n].np<<endl; cout<<"Alamat Penyewa : "<<ka[n].al<<endl; cout<<"No Hp Penyewa : "<<ka[n].nohp<<endl; cout<<"Jenis Kios : "<<ka[n].jk<<endl; cout<<"Lama Penyewaan (bulan): "<<ka[n].lp<<endl; cout<<"Jenis Pembayaran : "<<ka[n].jp<<endl; cout<<"Biaya : "<<ka[n].biaya<<endl; cout<<"Diskon : "<<ka[n].d<<endl; cout<<"Total Bayar : "<<ka[n].tb<<endl; cout<<"=================================="<<endl; } else { system("cls"); ka[n].biaya=150000; ka[n].d=0.1*ka[n].biaya; ka[n].tb=ka[n].biaya-ka[n].d; cout<<"=================================="<<endl; cout<<"| DAFTAR PEMBAYARAN |"<<endl; cout<<"----------------------------------"<<endl; cout<<"Id Penyewa : "<<ka[n].ip<<endl; cout<<"Nama Penyewa : "<<ka[n].np<<endl; cout<<"Alamat Penyewa : "<<ka[n].al<<endl; cout<<"No Hp Penyewa : "<<ka[n].nohp<<endl; cout<<"Jenis Kios : "<<ka[n].jk<<endl; cout<<"Lama Penyewaan (bulan): "<<ka[n].lp<<endl; cout<<"Jenis Pembayaran : "<<ka[n].jp<<endl; cout<<"Biaya : "<<ka[n].biaya<<endl; cout<<"Diskon : "<<ka[n].d<<endl; cout<<"Total Bayar : "<<ka[n].tb<<endl; cout<<"=================================="<<endl; } } } else { cout<<"Kode Anda Salah"<<endl; goto cas2; } } } else { cout<<"kode anda salah"<<endl; } break;}//kurung akhir case2 case 3: { goto user; break; } default: { cout<<"Kode Anda Salah"<<endl; } } } cout<<"Masih Ada Data(y/t)???";cin>>lagi; if (lagi=='y' || lagi=='Y') { goto pk; } else if (lagi=='t' || lagi=='T'){ cout<<" \n"; } }} return 0; }}
2. Tampilan Awal Program
ini adalah tampilan menu utama dari program penyewaan kios.
ini adalah tampilan dari submenu dari menu utama yaitu Penyewaan Kios Di Mall
ini adalah tampilan kios yang tersedia dari sub menu Daftar Kios yg ada
Baca Juga:
Membuat Program Menu Admin Bank Menggunakan C++
Membuat Program Penerimaan Mahasiswa Baru Menggunakan C++
0 komentar:
Posting Komentar
Silahkan beri komentar dengan bijak dan sesuai dengan topik artikel.
Gunakan tombol balas dibawah komentar terkait jika ingin membalas komentar agar komunikasi lebih terstruktur.
Klik untuk melihat kode :) :( :s :D :-D ^:D ^o^ 7:( :Q :p T_T @-@ :-a :W *fck* :ngakak |o| :goodluck :smile