Blogger templates

Pages

Jumat, 25 Oktober 2013

"@"Algoritma & Pemograman Sewa kamar (C++)

#include<iostream.h>
#include<conio.h>
#include<stdio.h>

main()
{
char kd_kamar,nm_penginap[20],kd_kls,nm_kls[8],nm_kamar[10],lagi;
int  lama,by;
long harga,total;
awal:
cout<<"\t\t\t============================================="<<endl;
cout<<"\t\t\t\t HOTEL BINA SARANA INFORMATIKA \n";
cout<<"\t\t\t============================================="<<endl;
cout<<"Nama Penginap : ";gets(nm_penginap);
cout<<"=================================================="<<endl;
cout<<"Pilihan Kamar :\n";
cout<<"\t\t1.Mawar \n";
cout<<"\t\t2.Melati \n";
cout<<"\t\t3.Anggrek \n";
cout<<"==================================================="<<endl;
cout<<"\nInput Pilihan Kamar [1/2/3] : ";cin>>kd_kamar;
cout<<"Input Pilihan Kelas [A/B]   : ";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=250000;
      if (kd_kls=='a'||kd_kls=='A')
      {strcpy(nm_kls,"VIP");
       by=25000; }
      else
      {strcpy(nm_kls,"Reguler");
       by=0; }
}
total=(lama*harga)+(lama*by);

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<<endl;
cout<<"Lama Inap      : "<<lama<<endl;
cout<<"Total          : "<<total;
cout<<"\n\nINGIN INPUT LAGI [Y/T] : "; cin>>lagi;
if (lagi == 'y' || lagi =='Y')
goto awal;
else
cout<<"TERIMA KASIH"<<endl;
getch();
}

Tidak ada komentar:

Posting Komentar