Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- int main()
- {
- char kelas, lagi;
- unsigned long ubay, kmb;
- string kopes, napes;
- unsigned long harga=0,tobay;
- int jutik;
- awal:
- cout<<"PROGRAM TIKET PESAWAT"<<endl;
- cout<<"JAKARTA-MALAYSIA"<<endl;
- cout<<"--------------------------------------\n";
- cout<<"masukan kode pesawat [MPT/GRD/BTV] :";cin>>kopes;
- cout<<"kelas pesawat\n"
- <<"1. Excekutif\n"
- <<"2. Bisnis\n"
- <<"3. Ekonomi\n";
- cout<<"pilih kelas [1/2/3]: "; cin>>kelas;
- cout<<endl;
- for (int ijk = 0; ijk < kopes.length(); ijk++) {
- kopes[ijk] = tolower(kopes[ijk]);
- }
- if (kopes=="mpt") {
- napes="MERPATI";
- if(kelas=='1') {
- harga=1500000;
- } else if(kelas=='2') {
- harga=900000;
- } else if(kelas=='3') {
- harga=500000;
- }
- }
- if (kopes=="grd") {
- napes="GARUDA";
- if(kelas=='1'){
- harga=1200000;
- } else if(kelas=='2') {
- harga=800000;
- } else if(kelas=='3') {
- harga=400000;
- }
- }
- if (kopes=="btv") {
- napes="BATAVIA";
- if(kelas=='1'){
- harga=1000000;
- } else if(kelas=='2') {
- harga=700000;
- } else if(kelas=='3') {
- harga=300000;
- }
- }
- cout<<"nama pesawat: " << napes << endl;
- cout<<"harga tiket: " << harga << endl;
- cout<<"masukan jumlah tiket : "; cin>>jutik;
- tobay= harga * jutik;
- cout<<"total bayar\t:"<<tobay<<endl;
- cout<<"uang bayar\t :";cin>>ubay;
- kmb=ubay-tobay;
- cout<<"kembalian\t :"<<kmb<<endl;
- cout<<"input data lagi [Y/T]:";cin>>lagi;
- if(lagi=='Y'|| lagi=='y')
- goto awal;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement