Tugas Program UBSI Borland C++, semester 1
selamat malam guyss...
semoga kalian baik-baik saja begitu juga dengan saya yahhh.
nahh, sekarang kita akan membahasa tentang "SELEKSI KONDISI"
masih tetap iya, topik programnya tentang Borland C++
#include <stdio.h>
#include <conio.h>
#include <iostream.h>
main()
{
char nk[23],np[23],kd[23],lagi,dcs[23];
int harga,kls,jml,pb,bt,dc,tp,ub,uk;
logo:
cout<<"\t\t\tPROGRAM TIKET KERETA\n";
cout<<"\t\t==============================\n\n";
cout<<"masukan koder kereta[AG/AL/PH]:\t";
cin>>kd;
cout<<"\npilihan kelas [1/2/3]:\n\n";
cout<<"1.Eksekutif\n";
cout<<"2.Bisnis\n";
cout<<"3.Ekonomi\n\n";
cout<<"masukan kelas [1/2/3]:\t";
cin>>kls;
atas:
clrscr();
cout<<"\t\t\tPROGRAM TIKET KERETA\n";
cout<<"\t\t==============================\n";
if (strcmp(kd,"AG")==0||strcmp(kd,"ag")==0)
{
strcpy(nk,"Arga kembar");
if(kls==1)
harga=42000;
else if(kls==2)
harga=10000;
else if(kls==3)
harga=6000;
}
else if (strcmp(kd,"AL")==0||strcmp(kd,"al")==0)
{
strcpy(nk,"Arga Lama");
if(kls==1)
harga=30000;
else if(kls==2)
harga=19000;
else if(kls==3)
harga=9000;
}
else if (strcmp(kd,"PH")==0||strcmp(kd,"ph")==0)
{
strcpy(nk,"naon nya?");
if(kls==1)
harga=230000;
else if(kls==2)
harga=18000;
else if(kls==3)
harga=4000;
}
else
{
cout<<"\n\nMAAF KODE YANG ANDA MASUKAN SALAH"<<endl<<endl;
cout<<"\n\n\n\n\n\t\t\t\t\tinput ulang [Y/T]?:";cin>>lagi;
if(lagi=='Y'||lagi=='y')
goto atas;
else
goto bawah;
}
cout<<"Nama Pemesan\t\t\t:";
cin>>np;
cout<<"Nama Kereta\t\t\t:"<<nk<<endl;
cout<<"Kelas Kereta\t\t\t:"<<kls<<endl;
cout<<"harga tiket\t\t\t:Rp."<<harga<<endl;
cout<<"jumlah pemesanan tiket\t\t:";
cin>>jml;
bt=12000;
cout<<"Biaya tambahan Fasilitas\t:"<<bt<<endl;
pb=harga*jml+bt;
cout<<"Pembayaran\t\t\t:"<<pb<<endl;
if (jml>5)
{
strcpy(dcs,"25 persen");
}
else
{ strcpy(dcs,"Maaf Anda Tidak Dapat discount");
}
cout<<"discout\t\t\t:"<<dcs<<"\n\n";
cout<<"*******************************************\n\n";
tp=0.25*pb;
cout<<"total pembayaran\t\t:Rp."<<tp<<endl;
cout<<"uang bayar\t\t\t:Rp.";
cin>>ub;
uk=ub-tp;
cout<<"uang kembali\t\t\t:Rp."<<uk<<endl;
cout<<" \n\n\n\n\t\t\t\t\ INGIN INPUT LAGI [Y/T]?:";cin>>lagi;
if(lagi=='Y'||lagi=='y')
goto atas;
else
goto bawah;
bawah:
{
clrscr();
cout<<"\n\n\n\n\n\t\t==================================\n ";
cout<<"\t\t\t....THANK YOU....\n ";
cout<<"\t\t================================== ";
}
getch();
}
di bawah ini hasil dari tampilan riket kereta api menggunakan C++
semoga kalian baik-baik saja begitu juga dengan saya yahhh.
nahh, sekarang kita akan membahasa tentang "SELEKSI KONDISI"
masih tetap iya, topik programnya tentang Borland C++
Program tiket Kereta Api dengan menggunakan bahasa C++
di bawah ini input program dalam proses penghitungan tiket kereta dengan menggunakan C++
#include <conio.h>
#include <iostream.h>
main()
{
char nk[23],np[23],kd[23],lagi,dcs[23];
int harga,kls,jml,pb,bt,dc,tp,ub,uk;
logo:
cout<<"\t\t\tPROGRAM TIKET KERETA\n";
cout<<"\t\t==============================\n\n";
cout<<"masukan koder kereta[AG/AL/PH]:\t";
cin>>kd;
cout<<"\npilihan kelas [1/2/3]:\n\n";
cout<<"1.Eksekutif\n";
cout<<"2.Bisnis\n";
cout<<"3.Ekonomi\n\n";
cout<<"masukan kelas [1/2/3]:\t";
cin>>kls;
atas:
clrscr();
cout<<"\t\t\tPROGRAM TIKET KERETA\n";
cout<<"\t\t==============================\n";
if (strcmp(kd,"AG")==0||strcmp(kd,"ag")==0)
{
strcpy(nk,"Arga kembar");
if(kls==1)
harga=42000;
else if(kls==2)
harga=10000;
else if(kls==3)
harga=6000;
}
else if (strcmp(kd,"AL")==0||strcmp(kd,"al")==0)
{
strcpy(nk,"Arga Lama");
if(kls==1)
harga=30000;
else if(kls==2)
harga=19000;
else if(kls==3)
harga=9000;
}
else if (strcmp(kd,"PH")==0||strcmp(kd,"ph")==0)
{
strcpy(nk,"naon nya?");
if(kls==1)
harga=230000;
else if(kls==2)
harga=18000;
else if(kls==3)
harga=4000;
}
else
{
cout<<"\n\nMAAF KODE YANG ANDA MASUKAN SALAH"<<endl<<endl;
cout<<"\n\n\n\n\n\t\t\t\t\tinput ulang [Y/T]?:";cin>>lagi;
if(lagi=='Y'||lagi=='y')
goto atas;
else
goto bawah;
}
cout<<"Nama Pemesan\t\t\t:";
cin>>np;
cout<<"Nama Kereta\t\t\t:"<<nk<<endl;
cout<<"Kelas Kereta\t\t\t:"<<kls<<endl;
cout<<"harga tiket\t\t\t:Rp."<<harga<<endl;
cout<<"jumlah pemesanan tiket\t\t:";
cin>>jml;
bt=12000;
cout<<"Biaya tambahan Fasilitas\t:"<<bt<<endl;
pb=harga*jml+bt;
cout<<"Pembayaran\t\t\t:"<<pb<<endl;
if (jml>5)
{
strcpy(dcs,"25 persen");
}
else
{ strcpy(dcs,"Maaf Anda Tidak Dapat discount");
}
cout<<"discout\t\t\t:"<<dcs<<"\n\n";
cout<<"*******************************************\n\n";
tp=0.25*pb;
cout<<"total pembayaran\t\t:Rp."<<tp<<endl;
cout<<"uang bayar\t\t\t:Rp.";
cin>>ub;
uk=ub-tp;
cout<<"uang kembali\t\t\t:Rp."<<uk<<endl;
cout<<" \n\n\n\n\t\t\t\t\ INGIN INPUT LAGI [Y/T]?:";cin>>lagi;
if(lagi=='Y'||lagi=='y')
goto atas;
else
goto bawah;
bawah:
{
clrscr();
cout<<"\n\n\n\n\n\t\t==================================\n ";
cout<<"\t\t\t....THANK YOU....\n ";
cout<<"\t\t================================== ";
}
getch();
}
di bawah ini hasil dari tampilan riket kereta api menggunakan C++
program kasir penginapan dengan Borland c++
di bawah ini input program dalam proses pembuatan program kasir penginapan dengan menggunakan C++
#include <conio.h>
#include <iostream.h>
main()
{
char np[35],suv[30],lagi,tpy[50],kk[20];
int harga,ttl,lm,jumlah,total,ba,uk,ub;
lagi='y';
atas:
cout<<"PENGINAPAN PASTI BETAH\n";
cout<<"****************************\n";
cout<<"nama penyewa\t:";
cin>>np;
cout<<"kode kamar[A/B/M]\t:";
cin>>kk;
cout<<"lama menginap\t:";
cin>>lm;
clrscr();
cout<<"PENGINAPAN PASTI BETAH\n";
cout<<"****************************\n";
if(strcmp(kk,"A")==0||strcmp(kk,"a")==0)
{strcpy (tpy,"anggrek");
harga=300000;
}
else if(strcmp(kk,"B")==0||strcmp(kk,"b")==0)
{strcpy (tpy,"bougenville");
harga=250000;
}
else if(strcmp(kk,"M")==0||strcmp(kk,"m")==0)
{strcpy (tpy,"mawar");
harga=200000;
}
else
{
cout<<"\n\nMAAF KODE YANG ANDA MASUKAN SALAH"<<endl<<endl;
cout<<"\n\n\n\n\n\t\t\t\t\tinput ulang [Y/T]?:";cin>>lagi;
if(lagi=='Y'||lagi=='y')
goto atas;
else
goto bawah;
}
cout<<"nama penyewa\t\t:"<<np<<endl;
cout<<"kode kamar [A/B/M]\t:"<<kk<<endl;
cout<<"lama menginap \t\t:"<<lm<<endl;
cout<<"****************************\n";
cout<<"type kamar \t\t:"<<tpy<<endl;
cout<<"lama menginap \t\t:"<<lm; cout<<"hari\n";
if(lm>=7)
{strcpy(suv,"payung");}
else
{
strcpy(suv, "Maaf Anda Tidak Dapat suvenir"); }
cout<<"souvenir\t\t:"<<suv<<endl;
ba=200000;
cout<<"biaya administrasi\t:"<<ba<<endl;
total=lm*harga+ba;
cout<<"total sewa\t\t:"<<total<<endl;
cout<<"*********************************\n";
cout<<"uang bayar\t\t:";
cin>>ub;
uk=ub-total;
cout<<"uang kembali\t\t:"<<uk<<endl;
cout<<" \n\n\n\n\t\t\t\t\ INGIN INPUT LAGI [Y/T]?:";cin>>lagi;
if(lagi=='Y'||lagi=='y')
goto atas;
else
goto bawah;
bawah:
{
clrscr();
cout<<"\n\n\n\n\n\t\t==================================\n ";
cout<<"\t\t\t....THANK YOU....\n ";
cout<<"\t\t================================== ";
}
getch();
}
#include <iostream.h>
main()
{
char np[35],suv[30],lagi,tpy[50],kk[20];
int harga,ttl,lm,jumlah,total,ba,uk,ub;
lagi='y';
atas:
cout<<"PENGINAPAN PASTI BETAH\n";
cout<<"****************************\n";
cout<<"nama penyewa\t:";
cin>>np;
cout<<"kode kamar[A/B/M]\t:";
cin>>kk;
cout<<"lama menginap\t:";
cin>>lm;
clrscr();
cout<<"PENGINAPAN PASTI BETAH\n";
cout<<"****************************\n";
if(strcmp(kk,"A")==0||strcmp(kk,"a")==0)
{strcpy (tpy,"anggrek");
harga=300000;
}
else if(strcmp(kk,"B")==0||strcmp(kk,"b")==0)
{strcpy (tpy,"bougenville");
harga=250000;
}
else if(strcmp(kk,"M")==0||strcmp(kk,"m")==0)
{strcpy (tpy,"mawar");
harga=200000;
}
else
{
cout<<"\n\nMAAF KODE YANG ANDA MASUKAN SALAH"<<endl<<endl;
cout<<"\n\n\n\n\n\t\t\t\t\tinput ulang [Y/T]?:";cin>>lagi;
if(lagi=='Y'||lagi=='y')
goto atas;
else
goto bawah;
}
cout<<"nama penyewa\t\t:"<<np<<endl;
cout<<"kode kamar [A/B/M]\t:"<<kk<<endl;
cout<<"lama menginap \t\t:"<<lm<<endl;
cout<<"****************************\n";
cout<<"type kamar \t\t:"<<tpy<<endl;
cout<<"lama menginap \t\t:"<<lm; cout<<"hari\n";
if(lm>=7)
{strcpy(suv,"payung");}
else
{
strcpy(suv, "Maaf Anda Tidak Dapat suvenir"); }
cout<<"souvenir\t\t:"<<suv<<endl;
ba=200000;
cout<<"biaya administrasi\t:"<<ba<<endl;
total=lm*harga+ba;
cout<<"total sewa\t\t:"<<total<<endl;
cout<<"*********************************\n";
cout<<"uang bayar\t\t:";
cin>>ub;
uk=ub-total;
cout<<"uang kembali\t\t:"<<uk<<endl;
cout<<" \n\n\n\n\t\t\t\t\ INGIN INPUT LAGI [Y/T]?:";cin>>lagi;
if(lagi=='Y'||lagi=='y')
goto atas;
else
goto bawah;
bawah:
{
clrscr();
cout<<"\n\n\n\n\n\t\t==================================\n ";
cout<<"\t\t\t....THANK YOU....\n ";
cout<<"\t\t================================== ";
}
getch();
}
di bawah ini adalah hasil dari tampilan oembuatan program penginapan pasti betah....!!!
sekian dari saya, semoga bermanfaat...
sampai jumpa minggu depan lagi yahhh
Komentar
Posting Komentar