- Program Sederhana Hotel Menggunakan ( IF – ELSE )
Source Code :
#include<iostream.h>
#include<conio.h>
#include<stdio.h>main()
{
char kd_kamar,nm_tamu[20],kd_kls,nm_kls[10],nm_kamar[10],ulang;
int lama,by;
long harga,total;awal:
clrscr();
//awal:
cout<<”==================================================”<<endl;
cout<<”\tHOTEL BINA SARANA INFORMATIKA \n”;
cout<<”==================================================”<<endl;
cout<<”Nama Penginap : “;gets(nm_tamu);
cout<<”==================================================”<<endl;
cout<<”Pilihan Kamar :\n”;
cout<<”1-Mawar \n”;
cout<<”2-Melati \n”;
cout<<”3-Anggrek \n”;
cout<<”===================================================”<<endl;
cout<<”Input Pilihan Kamar [1/2/3] : “;cin>>kd_kamar;
cout<<”Input Pilihan Kelas [A.VIP/B.REGULAR] : “;cin>>kd_kls;
cout<<”Lama Menginap : “;cin>>lama;if (kd_kamar==’1′)
{
strcpy(nm_kamar,”Mawar”);
if (kd_kls==’a’||kd_kls==’A’)
{strcpy(nm_kls,”VIP”);
by=25000;
harga=250000;}
else
{strcpy(nm_kls,”Reguler”);
by=0;
harga=250000;}
}
else if (kd_kamar==’2′)
{
strcpy(nm_kamar,”Melati”);
harga=200000;
if (kd_kls==’a’||kd_kls==’A’)
{strcpy(nm_kls,”VIP”);
by=25000; }
else
{strcpy(nm_kls,”Reguler”);
by=0; }
}
else
{
strcpy(nm_kamar,”Anggrek”);
harga=150000;
if (kd_kls==’a’||kd_kls==’A’)
{strcpy(nm_kls,”VIP”);
by=25000; }
else
{strcpy(nm_kls,”Reguler”);
by=0; }
}
total=lama*harga;clrscr();cout<<”\tHOTEL BINA SARANA INFORMATIKA \n”;
cout<<”===================================================”<<endl;
cout<<”Nama Penginap : “<<nm_tamu<<endl;
cout<<”Nama Kamar : “<<nm_kamar<<endl;
cout<<”Jenis Kelas : “<<nm_kls<<endl;
cout<<”Harga Kamar : “<<harga<<endl;
cout<<”Biaya Tambahan : “<<by<<endl;
cout<<”Lama Inap : “<<lama<<endl;
cout<<”Total : “<<total;printf(“\n\n”);
cout<<”\t INGIN INPUT LAGI [Y/T] : “; cin>>ulang;
if (ulang == ‘y’ || ulang == ‘Y’)
goto awal;
getch();
}Running :
Selasa, 29 Oktober 2013
"@"Program Sederhana Hotel Menggunakan ( IF – ELSE )
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar