Sebenarnya sih udah ga jamannya sewa video game , secara teknologi sekarang sudah sangat canggih , sudah bisa download game kapan saja .
Tapi buat belajar program Borland C++ tak apalah saya share sebisa saya ,,
Berikut listing programnya
#include<stdio.h>
#include<conio.h>
#include<iostream.h>
main()
{
char kode,game[17],nama[10];
int lama,harga,jumsewa,tobar,ubar,ukem;
clrscr();
cout<<"\tRENTAL VIDEO GAME"<<endl;
cout<<"======================================"<<endl;
cout<<"Kode \tVideo Game\tHarga Sewa"<<endl;
cout<<"--------------------------------------"<<endl;
cout<<"1 \tPlay Station 3\tRp 20.000,-"<<endl;
cout<<"2 \tX-Box\t\tRp 23.000,-"<<endl;
cout<<"3 \tNitendo Wii\tRp 25.000,-"<<endl;
cout<<"--------------------------------------"<<endl;
cout<<"Masukkan Nama Pelanggan\t : ";cin>>nama;
cout<<"Masukkan Kode Video Game : ";cin>>kode;
cout<<"Masukkan Jumlah Sewa\t : ";cin>>jumsewa;
cout<<"Masukkan Lama Sewa (jam) : ";cin>>lama;
cout<<"======================================"<<endl;
if(kode=='1')
{strcpy(game,"Play Station 3"); harga=20000;}
else if(kode=='2')
{strcpy(game,"X-Box");harga=23000;}
else
{strcpy(game,"Nitendo Wii");harga=25000;}
cout<<endl;
clrscr();
cout<<"============================================"<<endl;
cout<<"Nama Pelanggan\t : "<<nama<<endl;
cout<<"--------------------------------------------"<<endl;
cout<<"Kode Video Game\t\t : "<<kode<<endl;
cout<<"Nama Video Game\t\t : "<<game<<endl;
cout<<"Biaya Sewa/jam\t\t : "<<harga<<endl;
cout<<"Jumlah sewa\t\t : "<<jumsewa<<endl;
cout<<"Lama Sewa (jam)\t\t : "<<lama<<endl;
cout<<"--------------------------------------------"<<endl;
tobar=lama*harga*jumsewa;
cout<<"Total Bayar\t\t : Rp "<<tobar<<endl;
cout<<"Uang Bayar\t\t : Rp ";cin>>ubar;
ukem=ubar-tobar;
cout<<"Uang Kembali\t\t : Rp "<<ukem<<endl;
cout<<"===================================="<<endl;
cout<<"\nTERIMA KASIH ATAS KUNJUNGANNYA "<<endl<<endl;
cout<<"===================================="<<endl;
getch();
}
Dan hasilnya after run option dapat dilihat pada lampiran gambar berikut
Demikian contoh sederhana dari sebuah listing program di Borland C++ , terima kasih jika mau bersedia komen jika listing tersebut diatas masih ada yang kurang
Jakarta , 26 Oktober 2013
Like this
ReplyDeletekok gabisa ya di run
ReplyDeletesama
Delete