Background

Contoh Coding C++ untuk Program Hotel

//bara
#include
#include
#include

int main ()
{
int lm,bt,k,total,hk;
char nama [15],kamar,kelas,nk[10];

//input
cout<<"===================================================================";
cout<<"\n\t\t\tHOTEL BAQISHIBA\t\t\t";
cout<<"\n===================================================================";
cout<<"\nNama Penginap\t\t\t\t: ";cin>>nama;
cout<<"\nPilihan Kamar\t\n\t1.Mawar\n\t2.Melati\n\t3.Anggrek";
cout<<"\nInput Pilihat Kamar [ 1 / 2 / 3 ] \t: ";cin>>kamar;
cout<<"\nInput Pilihan Kelas [A.VIP/B.Reguler]\t: ";cin>>kelas;
cout<<"\nLama Menginap \t\t\t\t: ";cin>>lm;

clrscr();

//rumus
if (kamar=='1')
    {strcpy (nk,"Mawar");
   hk=250000;}
else if (kamar=='2')
    {strcpy (nk,"Melati");
   hk=200000;}
else if (kamar=='3')
    {strcpy (nk,"Anggrek");
   hk=150000;}
else
    {strcpy (nk,"-");
   hk=0;}

if (kamar=='1' && (kelas=='a'||kelas=='A'))
    bt=25000;
else
    bt=0;

total=(hk*lm)+bt;

//output
cout<<"======================================================";
cout<<"\n\t\t\tHOTEL BAQISHIBA\t\t\t";
cout<<"\n====================================================";
cout<<"\nNama Penginap\t: "<cout<<"\nNama Kamar\t: "<cout<<"\nKelas\t\t: "<cout<<"\nHarga Kamr\t: "<cout<<"\nBiaya Tambahan\t: "<cout<<"\nLama Inap\t: "<cout<<"\n=======================================================";
cout<<"\nTotal\t\t: "<cout<<"\n======================================================";
getch();
}

Categories: Share

Leave a Reply