Senin, 13 Januari 2014

Tugas UTS 2013 Borland C++

#include <conio.h>
#include <iostream.h>
main()
{
char koka,tp[10],noka[10],*nkamar,lagi;
int lama,harga,bayar,kembali,total;

program:
clrscr();
cout<<"\t\tPenginapan \"Bochi-Ank\"\n";
cout<<"======================================\n";
cout<<"Type Kamar <single/double/family>: ";cin>>tp;
cout<<"Kode Kamar <D/R/V> : ";cin>>koka;
cout<<"No Kamar           : ";cin>>noka;
cout<<"Lama Inap          : ";cin>>lama;
cout<<"======================================\n";
if (koka=='D'||koka=='d')
{
    nkamar="Deluxe";
    if(!strcmp(tp,"single")||!strcmp(tp,"SINGLE"))
    harga=250000;
    else if(!strcmp(tp,"double")||!strcmp(tp,"DOUBLE"))
    harga=375000;
    else if(!strcmp(tp,"family")||!strcmp(tp,"FAMILY"))
    harga=500000;
    else
    harga=0;
}
else if (koka=='R'||koka=='r')
{
    nkamar="Resident Suite";
   if(!strcmp(tp,"single")||!strcmp(tp,"SINGLE"))
   harga=350000;
   else if(!strcmp(tp,"double")||!strcmp(tp,"DOUBLE"))
   harga=575000;
   else if(!strcmp(tp,"family")||!strcmp(tp,"FAMILY"))
   harga=750000;
   else
   harga=0;
}
else if (koka=='V'||koka=='v')
{
    nkamar="VIP";
   if(!strcmp(tp,"single")||!strcmp(tp,"SINGLE"))
   harga=175000;
   else if(!strcmp(tp,"double")||!strcmp(tp,"DOUBLE"))
   harga=300000;
   else if(!strcmp(tp,"family")||!strcmp(tp,"FAMILY"))
   harga=450000;
   else
   harga=0;
}
else
{
   nkamar="KODE YANG ANDA MASUKKAN SALAH";
   if(!strcmp(tp,"single")||!strcmp(tp,"SINGLE"))
   harga=0;
   else if(!strcmp(tp,"double")||!strcmp(tp,"DOUBLE"))
   harga=0;
   else if(!strcmp(tp,"family")||!strcmp(tp,"FAMILY"))
   harga=0;
   else
   harga=0;
}
total=harga*lama;
cout<<"Type Kamar : "<<tp<<endl;
cout<<"KOde Kamar : "<<koka<<endl;
cout<<"Nama Kamar : "<<nkamar<<endl;
cout<<"Nomer Kamar : "<<noka<<endl;
cout<<"Harga Kamar : "<<harga<<endl;
cout<<"Total Bayar : "<<total<<endl;
cout<<"======================================\n";
cout<<"Masukkan Uang Bayar : Rp. ";cin>>bayar;
kembali=bayar-total;
cout<<"Uang Kembali        : Rp. "<<kembali<<endl<<endl;

cout<<"Input Data Lagi [Y/T] : ";cin>>lagi;
if(lagi=='Y'||lagi=='y')
goto program;
else
goto keluar;

 keluar:
}

Tidak ada komentar:

Posting Komentar

Hello World

" " " "