Berikut listing programnya
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
main()
{
char
kode,nm_penginap[15],kd_kls,nm_kamar[8],nm_kls[8],kamar[10],lagi;
int lama,by_tambahan;
long harga,total;
awal:
cout<<"=================================================="<<endl;
cout<<"\tHOTEL BINA SARANA INFORMATIKA \n";
cout<<"=================================================="<<endl;
cout<<"Nama Penginap : ";gets(nm_penginap);
cout<<"=================================================="<<endl;
cout<<"Pilihan Kamar :\n";
cout<<"\t\tA.MAWAR \n";
cout<<"\t\tB.MELATI \n";
cout<<"\t\tC.ANGGREK \n";
cout<<"==================================================="<<endl;
cout<<"\nInput Pilihan Kamar [A/B/C] :
";cin>>kode;
cout<<"Input Pilihan Kelas [1/2] : ";cin>>kd_kls;
cout<<"Lama Menginap : ";cin>>lama;
switch
(kode)
{
case
'A':
case 'a':
strcpy(nm_kamar,"MAWAR");
harga=250000;
break;
case 'B':
case 'b':
strcpy(nm_kamar,"MELATI");
harga=200000;
break;
case
'C':
case 'c':
strcpy(nm_kamar,"ANGGREK");
harga=150000;
break;
}
{
if (kd_kls=1)
{strcpy(nm_kls,"VIP");
by_tambahan=25000;}
else if(kd_kls=2)
{strcpy(nm_kls,"REGULER");
by_tambahan=0;}
}
total=lama*harga+(lama*by_tambahan);
clrscr();
cout<<"=========================================="<<endl;
cout<<"\tHOTEL BINA SARANA INFORMATIKA \n";
cout<<"=========================================="<<endl;
cout<<"Nama
Penginap : "<<nm_penginap<<endl;
cout<<"Nama
Kamar :
"<<nm_kamar<<endl;
cout<<"Jenis Kelas : "<<nm_kls<<endl;
cout<<"Harga Kamar : "<<harga<<endl;
cout<<"Biaya Tambahan :
"<<by_tambahan<<endl;
cout<<"Lama
Inap :
"<<lama;printf("\thari\n");
cout<<"=========================================="<<endl;
cout<<"Total : "<<total;
cout<<"\n=========================================="<<endl;
cout<<"\n\tINGIN INPUT LAGI [Y/T] : ";
cin>>lagi;
if (lagi == 'y' || lagi =='Y')
goto awal;
getch();
}
Daaaannnnn tampilannyan after Run :
Begitulah kira-kira contoh program sederhana yang bisa saya tampilkan kembali
Created by Joko Purwito on http://jokopurwito.blogspot.com
Jakarta , 24 Oktober 2013
good
ReplyDeletemasih ada yg error gan
ReplyDeletegan ijin copast
ReplyDelete