Asalamu alaikum Wr.Wb
Berikut ini adalah program c++ yang menggunakan ARRAY, FUNGSI, SELEKSI KONDISI, LABEL. semoga bermanfaat, dan dapat digunakan dengan semestinya :D
#include <stdio>
#include <conio>
#include <iostream>
#include <iomanip>
//fungsi judul
judul()
{
cout<<" PROGRAM TIKET BIOSKOP"<<endl;
cout<<" TWENTY CINEMA "<<endl;
}
//fungsi garis
garis()
{
cout<<"=========================================================="<<endl;
}
main()
{
int a,byktik[20],harga[9],bapem,jmlharga[10],tot[10],bayar,lagi,pajak,kmbli,totalbayar;
char nagas[30],hpen[10],nacus[20],satuan[9],nmf[10][20],kdf[10];
atas:
clrscr();
garis();
cout<<""<<endl;
judul();
cout<<""<<endl;
garis();
cout<<" "<<endl;
cout<<" ___________________________________"<<endl;
cout<<" | kode | Judul film | harga |"<<endl;
cout<<" ___________________________________"<<endl;
cout<<" | 1 | Single | Rp. 25000 |"<<endl;
cout<<" | 2 | Relationshit | Rp. 30000 |"<<endl;
cout<<" | 3 | Skamat | Rp. 35000 |"<<endl;
cout<<" | 4 | Minions | Rp. 30000 |"<<endl;
cout<<" ___________________________________"<<endl;
cout<<" "<<endl;
cout<<"Masukan Nama Petugas : ";gets(nagas);
cout<<"Masukan Nama Customer : ";gets(nacus);
cout<<"Banyak Pembelian : ";cin>>bapem;
cout<<" "<<endl;
garis();
for (a=1;a<=bapem;a++)
{
cout<<"Pembelian ke-"<<a<<endl;
cout<<" "<<endl;
cout<<"Masukan Kode Film : ";cin>>kdf[a];
cout<<"Banyak tiket : ";cin>>byktik[a];
if(kdf[a]=='1')
{
strcpy(nmf[a],"Single");
harga[a]=25000;
}
else if(kdf[a]=='2')
{
strcpy(nmf[a],"Relationshit");
harga[a]=30000;
}
else if(kdf[a]=='3')
{
strcpy(nmf[a],"Skakmat");
harga[a]=35000;
}
else if(kdf[a]=='4')
{
strcpy(nmf[a],"Minions");
harga[a]=40000;
}
else
{
strcpy(nmf[a],"-");
harga[a]=0;
}
jmlharga[a]=byktik[a]*harga[a];
tot[bapem]=tot[bapem]+jmlharga[a];
}
pajak=0,1*tot[bapem];
clrscr();
garis();
cout<<""<<endl;
judul();
cout<<""<<endl;
garis();
cout<<""<<endl;
cout<<"No. Nama Film Harga Jumlah Tiket Jumlah Harga "<<endl;
for (a=1;a<=bapem;a++)
{
cout<<a<<" "<<nmf[a]<<" "<<harga[a]<<" "<<byktik[a]<<" "<<jmlharga[a];
cout<<endl;
}
cout<<""<<endl;
garis();
cout<<""<<endl;
cout<<" Jumlah Bayar : "<<tot[bapem]<<endl;
pajak=0.1*tot[bapem];
cout<<" Pajak 10% : "<<pajak<<endl;
totalbayar=tot[bapem]+pajak;
cout<<" Total Bayar : "<<totalbayar<<endl;
cout<<" Bayar : ";cin>>bayar;
kmbli=bayar-totalbayar;
cout<<" Kembali : "<<kmbli<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<" Ingin Pilih Lagi[Y/T]:";
lagi=getche();
if(lagi=='Y'||lagi=='y')
goto atas;
getch();
}
dibawah ini hasin dari coding diatas
1. Input
Berikut ini adalah program c++ yang menggunakan ARRAY, FUNGSI, SELEKSI KONDISI, LABEL. semoga bermanfaat, dan dapat digunakan dengan semestinya :D
#include <stdio>
#include <conio>
#include <iostream>
#include <iomanip>
//fungsi judul
judul()
{
cout<<" PROGRAM TIKET BIOSKOP"<<endl;
cout<<" TWENTY CINEMA "<<endl;
}
//fungsi garis
garis()
{
cout<<"=========================================================="<<endl;
}
main()
{
int a,byktik[20],harga[9],bapem,jmlharga[10],tot[10],bayar,lagi,pajak,kmbli,totalbayar;
char nagas[30],hpen[10],nacus[20],satuan[9],nmf[10][20],kdf[10];
atas:
clrscr();
garis();
cout<<""<<endl;
judul();
cout<<""<<endl;
garis();
cout<<" "<<endl;
cout<<" ___________________________________"<<endl;
cout<<" | kode | Judul film | harga |"<<endl;
cout<<" ___________________________________"<<endl;
cout<<" | 1 | Single | Rp. 25000 |"<<endl;
cout<<" | 2 | Relationshit | Rp. 30000 |"<<endl;
cout<<" | 3 | Skamat | Rp. 35000 |"<<endl;
cout<<" | 4 | Minions | Rp. 30000 |"<<endl;
cout<<" ___________________________________"<<endl;
cout<<" "<<endl;
cout<<"Masukan Nama Petugas : ";gets(nagas);
cout<<"Masukan Nama Customer : ";gets(nacus);
cout<<"Banyak Pembelian : ";cin>>bapem;
cout<<" "<<endl;
garis();
for (a=1;a<=bapem;a++)
{
cout<<"Pembelian ke-"<<a<<endl;
cout<<" "<<endl;
cout<<"Masukan Kode Film : ";cin>>kdf[a];
cout<<"Banyak tiket : ";cin>>byktik[a];
if(kdf[a]=='1')
{
strcpy(nmf[a],"Single");
harga[a]=25000;
}
else if(kdf[a]=='2')
{
strcpy(nmf[a],"Relationshit");
harga[a]=30000;
}
else if(kdf[a]=='3')
{
strcpy(nmf[a],"Skakmat");
harga[a]=35000;
}
else if(kdf[a]=='4')
{
strcpy(nmf[a],"Minions");
harga[a]=40000;
}
else
{
strcpy(nmf[a],"-");
harga[a]=0;
}
jmlharga[a]=byktik[a]*harga[a];
tot[bapem]=tot[bapem]+jmlharga[a];
}
pajak=0,1*tot[bapem];
clrscr();
garis();
cout<<""<<endl;
judul();
cout<<""<<endl;
garis();
cout<<""<<endl;
cout<<"No. Nama Film Harga Jumlah Tiket Jumlah Harga "<<endl;
for (a=1;a<=bapem;a++)
{
cout<<a<<" "<<nmf[a]<<" "<<harga[a]<<" "<<byktik[a]<<" "<<jmlharga[a];
cout<<endl;
}
cout<<""<<endl;
garis();
cout<<""<<endl;
cout<<" Jumlah Bayar : "<<tot[bapem]<<endl;
pajak=0.1*tot[bapem];
cout<<" Pajak 10% : "<<pajak<<endl;
totalbayar=tot[bapem]+pajak;
cout<<" Total Bayar : "<<totalbayar<<endl;
cout<<" Bayar : ";cin>>bayar;
kmbli=bayar-totalbayar;
cout<<" Kembali : "<<kmbli<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<" Ingin Pilih Lagi[Y/T]:";
lagi=getche();
if(lagi=='Y'||lagi=='y')
goto atas;
getch();
}
dibawah ini hasin dari coding diatas
1. Input
2. Output
untuk download codingnya silahkan klik dibawah ini :
terimakasih semoga bermanfaat :D
Wasalamu alaikum Wr. Wb.