Contoh Program Tiket Pesawat dengan c++


Thanks Udah Ngunjungin Blog ane lagi nih,.hehe
Seperti biasanya nih ane mau ngeshare contoh kodingan program c++.
Semoga Bermanfaat,.



"CONTOH KODINGAN PROGRAM TIKET PESAWAT"


//File Header
#include<conio.h>
#include<stdio.h>
#include<iostream.h>
main()
{
//Tipe Data
char kp[20],pk[10],*napes,lagi;
int jt,h,total;
atas:
//Input
cout<<"Kode Pesawat [MPT/GRD/BTV] :";cin>>kp;
cout<<"Kelas Pesawat :"<<endl;
cout<<"1.Executive"<<endl;
cout<<"2.Bisnis"<<endl;
cout<<"3.Ekonomi"<<endl;
cout<<"Pilih Kelas [1/2/3] :";cin>>pk;
cout<<"Jumlah Tiket :";cin>>jt;

   //Proses
if(strcmp(kp, "MPT") == 0 || strcmp(kp, "mpt") == 0)
{
napes="Merpati";
if (strcmp(pk, "1") == 0 )
h=50000;
else if(strcmp(pk, "2") == 0)
h=40000;
else if(strcmp(pk, "3") == 0 )
h=30000;
else
h=0;
}
else if(strcmp(kp,"GRD") == 0 || strcmp(kp, "grd") == 0)
{napes="Garuda";
if(strcmp(pk, "1") == 0)
h=55000;
else if(strcmp(pk,"2") == 0)
h=45000;
else if(strcmp(pk,"3") == 0)
h=35000;
else
h=0;
}
else if(strcmp(kp, "BTV") == 0 || strcmp(kp, "btv") == 0)
{napes="Batavia";
if (strcmp(pk, "1") == 0)
h=60000;
else if(strcmp(pk, "2") == 0 )
h=70000;
else if(strcmp (pk, "3") == 0)
h=80000;
else
h=0;
}

     //Output  
clrscr();
cout<<"Kode Pesawat [MPT/GRD/BTV] :"<<kp<<endl;
cout<<"Kelas Pesawat :"<<endl;
cout<<"1.Executive"<<endl;
cout<<"2.Bisnis"<<endl;
cout<<"3.Ekonomi"<<endl;
cout<<"Pilih Kelas [1/2/3] :"<<pk<<endl;

cout<<"Nama Pesawat :"<<napes<<endl;
cout<<"Harga Tiket :"<<h<<endl;
cout<<"Jumlah TIKET :"<<jt<<endl;

total=h*jt;
cout<<"Total Bayar :"<<total<<endl;
cout<<"Ingin Input Lagi [Y/T]:";cin>>lagi;
if(lagi=='Y' || lagi=='y')
goto atas;
else
{
clrscr();
cout<<"Terima Kasih"<<endl;
}
      //Penutup
getch();
}





1 Komentar