//File Header #include<conio.h> #include<stdio.h> #include<iostream.h> main() { //Deklarasi variabel char nama[20], kodekon, kodejen, jenis[10], judul[20], lagi; int jumbel, harga, tothar, totbay, ubay, ukem, diskon; atas: //Input clrscr(); cout<<"==========================================="<<endl; cout<<" Penjualan Tiket Konser "<<endl; cout<<"==========================================="<<endl; cout<<endl; cout<<"Nama Pembeli :";gets(nama); ulangkodekon: cout<<"kode Konser [1/2/3] :";cin>>kodekon; ulangjenis: cout<<"Jenis Tiket"<<endl; cout<<"1. Tribune"<<endl; cout<<"2. VIP"<<endl; cout<<"3. VVIP"<<endl; cout<<"Jenis Tiket [1/2/3] :";cin>>kodejen; //Percabangan if (kodekon=='1') { strcpy(judul,"Java Jazz Festival"); if (kodejen=='1') {harga=50000; strcpy(jenis,"Tribune");} else if (kodejen=='2') {harga=75000; strcpy(jenis,"VIP");} else if (kodejen=='3') {harga=100000; strcpy(jenis,"VVIP");} else { cout<<"Jenisnya Salah Cyn...!!!"<<endl; goto ulangjenis; } } else if (kodekon=='2') { strcpy(judul,"Young Diva in Concert"); if (kodejen=='1') {harga=50000; strcpy(jenis,"Tribune");} else if (kodejen=='2') {harga=100000; strcpy(jenis,"VIP");} else if (kodejen=='3') {harga=150000; strcpy(jenis,"VVIP");} else { cout<<"Jenisnya Salah Cyn...!!!"<<endl; goto ulangjenis; } } else if (kodekon=='3') { strcpy(judul,"LA Light IndieFest"); if (kodejen=='1') {harga=50000; strcpy(jenis,"Tribune");} else if (kodejen=='2') {harga=90000; strcpy(jenis,"VIP");} else if (kodejen=='3') {harga=130000; strcpy(jenis,"VVIP");} else { cout<<"Jenisnya Salah Cyn...!!!"<<endl; goto ulangjenis; } } else { cout<<"Kode Koser Salah Cyn...!!!"<<endl; goto ulangkodekon; } cout<<"Jumlah Beli : ";cin>>jumbel; tothar=jumbel*harga; if (jumbel>5) {diskon = 0.1*tothar ;} else {diskon = 0 ;} totbay=tothar-diskon; //Output clrscr(); cout<<"==========================================="<<endl; cout<<" Penjualan Tiket Konser "<<endl; cout<<"==========================================="<<endl; cout<<endl; cout<<"Nama Pembeli :"<<nama<<endl; cout<<"Judul Konser :"<<judul<<endl; cout<<"Jenis Tiket :"<<jenis<<endl; cout<<"Harga Tiket :Rp "<<harga<<endl; cout<<"Jumlah Beli :"<<jumbel<<endl; cout<<"==========================================="<<endl; cout<<"Total Harga :Rp "<<tothar<<endl; cout<<"Potongan :Rp "<<diskon<<endl; cout<<"Total Bayar :Rp "<<totbay<<endl; cout<<"==========================================="<<endl; uangbayar: cout<<"Uang Bayar :Rp "; cin>>ubay; if (ubay < totbay) { cout<<"Uang ente kurang Cyn...."<<endl; goto uangbayar; } ukem=ubay-totbay; cout<<"Uang Kembali :Rp "<<ukem<<endl; cout<<"==========================================="<<endl; cout<<" Have Fun And Enjoy The Show... "<<endl; cout<<" By 12120421 "<<endl; cout<<endl; cout<<"Input Tiket Lagi [Y|N] ...? ";cin>>lagi; if (lagi=='Y' || lagi=='y') {goto atas;} getch(); }
Tugas Nested-IF Music Pert.6 Sem 1
Posted In
12.1C.07,
Algoritma dan Pemrograman,
BSI,
Semester I
- 4/23/2012 - 1 comments
Subscribe to:
Post Comments (Atom)
1 comments - Add Yours
"Permisi kak mau tannya ini masalhnya dimna ya , kok gak fix mulu, terimakasih sebelumnya , troubleshootingnya kirim ke email ya mas/mba <83j4l@dr.com>
#include
#include
#include
main()
{
char to[50],pet[20],nm[20],pak[30];
int tgl;
long kode,hrg=0,biaya=0,grp;
cout<<" TRAVEL AGENT ZALW@N"<>pet;
cout<<"Input Nama Costumer : ";cin>>nm;
cout<<"Pilih Kode Tujuan [BL/BT/JG] : ";cin>>kode;
cout<<"Pilih Kode Group [F/C] : ";cin>>grp;
cout<<"Input Tanggal Keberangkatan : ";cin>>tgl;
if(kode=='bl' || kode=='BL')
{
strcpy(to,"BALI");
if(grp=='F')
{
strcpy(pak,"Family");
hrg=3000000;
biaya=(hrg * 50)/100;
}
else if(grp=='C')
{
strcpy(pak,"Company");
hrg=4000000;
biaya=(hrg * 100)/100;
}
}
else if(kode=='bt' || kode=='BT')
{
strcpy(to,"BATAM");
if(grp=='F')
{
strcpy(pak,"Family");
hrg=5000000;
biaya=(hrg * 150)/100;
}
else if(grp=='C')
{
strcpy(pak,"Company");
hrg=8000000;
biaya=(hrg * 50)/100;
}
}
else if(kode=='jg' || kode=='JG')
{
strcpy(to,"JOGJAKARTA");
if(grp=='F')
{
strcpy(pak,"Family");
hrg=6000000;
biaya=(hrg * 100)/100;
}
else if(grp=='C')
{
strcpy(pak,"Company");
hrg=9000000;
biaya=(hrg * 50)/100;
}
}
cout<<" BUKU PEMESANAN PAKET LIBURAN"<<endl;
cout<<" TRAVEL AGENT ZALW@N "<<endl;
cout<<"=============================="<<endl;
cout<<""<<endl;
cout<<"Nama Petugas : "<<pet<<endl;
cout<<"Nama Custemer : "<<nm<<endl;
cout<<"=============================="<<endl;
cout<<""<<endl;
cout<<"Tujuan Wisata : "<<to<<endl;
cout<<"Paket Wisata : "<<pak<<endl;
cout<<"Harga : "<<hrg<<endl;
cout<<"Biaya Akomodasi : "<<biaya<<endl;
getch();
}
Post a Comment