#include<conio.h>
#include<iostream.h>
#include<stdio.h>
#include<iomanip.h>
main()
{
struct
{
char kode,nama[30],kelas[10];
int lama, harga, bayar;
}hotel[10];
int i,data,total=0;
char lagi;
atas:
clrscr();
cout<<"jumlah data : "; cin>>data;
cout<<endl;
for(i=1; i<=data; i++)
{
cout<<"Data ke : "<<i<<endl;
cout<<"Nama penginap : "; cin>>hotel[i].nama;
cout<<"Kode kamar [V/R] : "; cin>>hotel[i].kode;
if (hotel[i].kode =='V' || hotel[i].kode =='v')
{strcpy(hotel[i].kelas,"VIP"); hotel[i].harga=350000;}
else if (hotel[i].kode=='R' || hotel[i].kode=='r')
{strcpy(hotel[i].kelas,"Reguler"); hotel[i].harga=175000;}
else
{goto atas;}
cout<<"Lama inap : "; cin>>hotel[i].lama;
hotel[i].bayar=(hotel[i].lama*hotel[i].harga);
cout<<endl;
}
{strcpy(hotel[i].kelas,"VIP"); hotel[i].harga=350000;}
else if (hotel[i].kode=='R' || hotel[i].kode=='r')
{strcpy(hotel[i].kelas,"Reguler"); hotel[i].harga=175000;}
else
{goto atas;}
cout<<"Lama inap : "; cin>>hotel[i].lama;
hotel[i].bayar=(hotel[i].lama*hotel[i].harga);
cout<<endl;
}
/*By. Labslicious */
clrscr();
cout<<"========================================================"<<endl;
cout<<" DAFTAR PENGINAPAN HOTEL LABSLICIOUS"<<endl;
cout<<"NO Nama Penginap Kelas Lama Inap Harga Bayar"<<endl;
cout<<"========================================================"<<endl;
for(i=1; i<=data; i++)
{
cout<<setiosflags(ios::right)<<setw(0)<<i<<" ";
cout<<setiosflags(ios::left)<<setw(19)<<hotel[i].nama;
cout<<setiosflags(ios::left)<<setw(16)<<hotel[i].kelas;
cout<<setiosflags(ios::left)<<setw(12)<<hotel[i].lama;
cout<<setiosflags(ios::left)<<setw(12)<<hotel[i].harga;
cout<<setiosflags(ios::left)<<setw(10)<<hotel[i].bayar<<endl;
total=hotel[i].harga + total;
}
cout<<"======================================================"<<endl;
cout<<" Total : "<<total<<endl;
cout<<"INPUT Lagi [Y/T] : "; lagi=getche();
if(lagi=='Y' || lagi=='y')
goto atas;
getche();
}
Post a Comment