#include <conio.h>
#include <iostream.h>
void kelasA()
{
float k, n, b, d, t;
cout<<" masukan no kamar : ";
cout<<"001/002 : ";
cin>>k;
cout<<endl;
b=200000;
cout<<"Biaya sewa Per Hari :"<<b<<endl;
d=b*0.1;
cout<<"Diskon : 10%"<<endl;
t=b-d;
cout<<"total :"<<t<<endl;
};
void kelasB()
{
float k, n, b, d, t;
cout<<" masukan no kamar : ";
cout<<" 003/004 : ";
cin>>k;
cout<<endl;
b=300000;
cout<<"Biaya sewa Per Hari :"<<b<<endl;
d=b*0.2;
cout<<"Diskon :20%"<<endl;
t=b-d;
cout<<"total :"<<t<<endl;
};
void kelasC()
{
float k, n, b, d, t;
cout<<" masukan no kamar : ";
cout<<" 005/007 :";
cin>>k;
b=400000;
cout<<"Biaya sewa Per Hari :"<<b<<endl;
d=b*0.3;
cout<<"Diskon :30%"<<endl;
t=b-d;
cout<<"total :"<<t<<endl;
};
void main ()
{
float diskon, total;
long int sewa;
float lama, no, hari;
char pil;
cout<<" APLIKASI HOTEL "<<endl;
cout<<"================================="<<endl;
cout<<" silahkan masukan kelas (A/B/C):";cin>>pil;
cout<<endl<<endl;
if (pil=='A')
{
kelasA();
}
else if (pil=='B')
{
kelasB();
}
else if (pil=='C')
{
kelasC();
}
cout<<endl<<endl<<endl;
cout<<" selamat bersantai ";
getch();
}
contoh program ketika diRUN
#include <iostream.h>
void kelasA()
{
float k, n, b, d, t;
cout<<" masukan no kamar : ";
cout<<"001/002 : ";
cin>>k;
cout<<endl;
b=200000;
cout<<"Biaya sewa Per Hari :"<<b<<endl;
d=b*0.1;
cout<<"Diskon : 10%"<<endl;
t=b-d;
cout<<"total :"<<t<<endl;
};
void kelasB()
{
float k, n, b, d, t;
cout<<" masukan no kamar : ";
cout<<" 003/004 : ";
cin>>k;
cout<<endl;
b=300000;
cout<<"Biaya sewa Per Hari :"<<b<<endl;
d=b*0.2;
cout<<"Diskon :20%"<<endl;
t=b-d;
cout<<"total :"<<t<<endl;
};
void kelasC()
{
float k, n, b, d, t;
cout<<" masukan no kamar : ";
cout<<" 005/007 :";
cin>>k;
b=400000;
cout<<"Biaya sewa Per Hari :"<<b<<endl;
d=b*0.3;
cout<<"Diskon :30%"<<endl;
t=b-d;
cout<<"total :"<<t<<endl;
};
void main ()
{
float diskon, total;
long int sewa;
float lama, no, hari;
char pil;
cout<<" APLIKASI HOTEL "<<endl;
cout<<"================================="<<endl;
cout<<" silahkan masukan kelas (A/B/C):";cin>>pil;
cout<<endl<<endl;
if (pil=='A')
{
kelasA();
}
else if (pil=='B')
{
kelasB();
}
else if (pil=='C')
{
kelasC();
}
cout<<endl<<endl<<endl;
cout<<" selamat bersantai ";
getch();
}
contoh program ketika diRUN
Posting Komentar