PROGRAM C++ PEMBELIAN
PEMBELIAN TIKET BIOSKOP
#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 | Danur 2 | Rp. 25000 |"<<endl;
cout<<" | 2 | Rompis | Rp. 30000 |"<<endl;
cout<<" | 3 | Dear nathan | 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],"Danur 2");
harga[a]=25000;
}
else if(kdf[a]=='2')
{
strcpy(nmf[a],"Rompis");
harga[a]=30000;
}
else if(kdf[a]=='3')
{
strcpy(nmf[a],"dear nathan");
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();
}
==================================================================================================
PEMBELIAN JAKET
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
main()
{
char nm_pembeli[15],no_tlp[10],kode,merk[8],ukuran,lagi;
long harga=0,total,bayar,kembalian;
int jum_beli;
awal:
cout<<"==========================================="<<endl;
cout<<"\tAZKIA JAKET\n";
cout<<"==========================================="<<endl;
cout<<"Nama Pembeli : ";cin>>nm_pembeli;
cout<<"No.Tlp : ";cin>>no_tlp;
cout<<"Input Kode Jaket [1/2] : ";cin>>kode;
cout<<"Input Ukuran Jaket : ";cin>>ukuran;
cout<<"Input Jumlah Beli : ";cin>>jum_beli;
if (kode=='1')
{
strcpy(merk,"EIGER");
if (ukuran=='s'||ukuran=='S')
harga=150000;
if (ukuran=='m'||ukuran=='M')
harga=220000;
if(ukuran=='l'||ukuran=='L' )
harga=250000;
}
else if (kode=='2')
{
strcpy(merk,"POLO");
if (ukuran=='s'||ukuran=='S')
harga=100000;
if (ukuran=='m'||ukuran=='M')
harga=150000;
if (ukuran=='l'||ukuran=='L' )
harga=200000;
}
total=jum_beli*harga ;
clrscr();
cout<<"==========================================="<<endl;
cout<<"\tJAKET SERBA NYAMAN \n";
cout<<"==========================================="<<endl;
cout<<"Nama Pembeli : "<<nm_pembeli;cout<<"\tNo.Tlp : "<<no_tlp<<endl;
printf("\nPilihan Kode Jaket : ");
printf("\n\n\t1. Untuk kode Jaket EIGER");
printf("\n\t2. Untuk kode Jaket POLO ");
cout<<"\n==========================================="<<endl;
cout<<"\nKode Jaket : "<<kode<<endl;
cout<<"Ukuran (S/M/L) : "<<ukuran<<endl;
cout<<"Jumlah Beli : "<<jum_beli<<endl;
cout<<"Merk Barang : "<<merk<<endl;
cout<<"Harga Barang : "<<harga<<endl;
cout<<"Total Bayar : "<<total<<endl;
cout<<"Bayar : ";cin>>bayar;
kembalian=bayar-total;
cout<<"Kembalian : "<<kembalian;
cout<<"\n==========================================="<<endl;
cout<<"\nINGIN INPUT LAGI [Y/T] : "; cin>>lagi;
if (lagi == 'y' || lagi =='Y')
goto awal;
getch();
}
#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 | Danur 2 | Rp. 25000 |"<<endl;
cout<<" | 2 | Rompis | Rp. 30000 |"<<endl;
cout<<" | 3 | Dear nathan | 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],"Danur 2");
harga[a]=25000;
}
else if(kdf[a]=='2')
{
strcpy(nmf[a],"Rompis");
harga[a]=30000;
}
else if(kdf[a]=='3')
{
strcpy(nmf[a],"dear nathan");
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();
}
==================================================================================================
PEMBELIAN JAKET
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
main()
{
char nm_pembeli[15],no_tlp[10],kode,merk[8],ukuran,lagi;
long harga=0,total,bayar,kembalian;
int jum_beli;
awal:
cout<<"==========================================="<<endl;
cout<<"\tAZKIA JAKET\n";
cout<<"==========================================="<<endl;
cout<<"Nama Pembeli : ";cin>>nm_pembeli;
cout<<"No.Tlp : ";cin>>no_tlp;
cout<<"Input Kode Jaket [1/2] : ";cin>>kode;
cout<<"Input Ukuran Jaket : ";cin>>ukuran;
cout<<"Input Jumlah Beli : ";cin>>jum_beli;
if (kode=='1')
{
strcpy(merk,"EIGER");
if (ukuran=='s'||ukuran=='S')
harga=150000;
if (ukuran=='m'||ukuran=='M')
harga=220000;
if(ukuran=='l'||ukuran=='L' )
harga=250000;
}
else if (kode=='2')
{
strcpy(merk,"POLO");
if (ukuran=='s'||ukuran=='S')
harga=100000;
if (ukuran=='m'||ukuran=='M')
harga=150000;
if (ukuran=='l'||ukuran=='L' )
harga=200000;
}
total=jum_beli*harga ;
clrscr();
cout<<"==========================================="<<endl;
cout<<"\tJAKET SERBA NYAMAN \n";
cout<<"==========================================="<<endl;
cout<<"Nama Pembeli : "<<nm_pembeli;cout<<"\tNo.Tlp : "<<no_tlp<<endl;
printf("\nPilihan Kode Jaket : ");
printf("\n\n\t1. Untuk kode Jaket EIGER");
printf("\n\t2. Untuk kode Jaket POLO ");
cout<<"\n==========================================="<<endl;
cout<<"\nKode Jaket : "<<kode<<endl;
cout<<"Ukuran (S/M/L) : "<<ukuran<<endl;
cout<<"Jumlah Beli : "<<jum_beli<<endl;
cout<<"Merk Barang : "<<merk<<endl;
cout<<"Harga Barang : "<<harga<<endl;
cout<<"Total Bayar : "<<total<<endl;
cout<<"Bayar : ";cin>>bayar;
kembalian=bayar-total;
cout<<"Kembalian : "<<kembalian;
cout<<"\n==========================================="<<endl;
cout<<"\nINGIN INPUT LAGI [Y/T] : "; cin>>lagi;
if (lagi == 'y' || lagi =='Y')
goto awal;
getch();
}
====================================================================================================
RESTRAURANT AYAM
#include<conio.h>
#include<stdio.h>
#include<iostream.h>
#include<iomanip.h>
main( )
{
char x,jenis[10];
int i,hrg,banyk_j,banyk_beli[100],j_hrg[10],j_bay=0;
long tot_bay;
float pajak;
pilihan:
clrscr();
cout<<"=============================="<<endl;
cout<<" RESTAURANT AYAM "<<endl;
cout<<"=============================="<<endl;
cout<<"A. Ayam Bakar Madu |"<<endl;
cout<<"B. Ayam Bakar Sambal Hijau |"<<endl;
cout<<"C. Ayam Goreng Crispy | "<<endl;
cout<<"D. Sup Ayam Ceker | "<<endl;
cout<<"E. Ayam Mercon Pedas |"<<endl;
cout<<"=============================="<<endl;
cout<<"\n";
cout<<"Input Banyak Menu : ";cin>>banyk_j;
cout<<endl;
for(i=1;i<=banyk_j;i++)
{
cout<<"Menu Ke - "<<i<<endl;
cout<<"Kode Menu [A/B/C/D/E] : ";cin>>jenis[i];
cout<<"Kuantiti/Porsi : ";cin>>banyk_beli[i];
cout<<endl;
}
cout<<endl;
cout<<" RESTAURANT AYAM 4307"<<endl;
cout<<"------------------------------------------------------------"<<endl;
cout<<"No. Menu Harga Kuantiti Jumlah"<<endl;
cout<<" Ayam Satu Porsi Porsi Harga"<<endl;
cout<<"------------------------------------------------------------"<<endl;
for(i=1;i<=banyk_j;i++)
{
cout<<setiosflags(ios::left)<<setw(5)<<i;
cout<<setiosflags(ios::left)<<setw(20);
if(jenis[i]=='A'||jenis[i]=='a')
{
cout<<"Ayam Bakar Madu";
cout<<setw(18)<< setiosflags(ios::left);
hrg=25000;
cout<<"25000";
}
else if (jenis[i]=='B'||jenis[i]=='b')
{
cout<<"Ayam Bakar S.Hijau";
cout<<setw(18)<< setiosflags(ios::left);
hrg=26000;
cout<<"26000";
}
else if (jenis[i]=='C'||jenis[i]=='c')
{
cout<<"Ayam Goreng Crispy";
cout<<setw(18)<< setiosflags(ios::left);
hrg=20000;
cout<<"20000";
}
else if (jenis[i]=='D'||jenis[i]=='d')
{
cout<<"Sup Ayam Ceker";
cout<<setw(18)<< setiosflags(ios::left);
hrg=15000;
cout<<"15000";
}
else if (jenis[i]=='E'||jenis[i]=='e')
{
cout<<"Ayam Mercon Pedas";
cout<<setw(18)<< setiosflags(ios::left);
hrg=27000;
cout<<"27000";
}
else
{
cout<<"Salah Kode";
cout<<setw(18)<< setiosflags(ios::left);
hrg=0;
cout<<"0";
}
cout<<setiosflags(ios::left)<<setw(8)<<banyk_beli[i];
j_hrg[i]= banyk_beli[i] * hrg;
cout<<"Rp "<<j_hrg[i]<<endl ;
j_bay= j_bay + j_hrg [i];
}
cout<<"------------------------------------------------------------"<<endl;
cout<< " \t\tJumlah Bayar Rp "<<j_bay<< endl ;
pajak = (j_bay*10)/100;
cout<< " \t\tPajak(10%) Rp "<<pajak<<endl;
tot_bay = j_bay+pajak;
cout<< " \t\tToyal Bayar Rp "<<tot_bay<<endl<<endl ;
cout<<"==================TERIMA KASIH================\t"<<endl<<endl;
c
cout<<"===========Selamat Berbelanja Kembali==========\t"<<endl<<endl;
cout<<"KEMBALI KE MENU AWAL [Y/X]??:";cin>>x;
if(x=='Y'||x=='y')
{
clrscr();
goto pilihan;
}
getch();
}
#include<stdio.h>
#include<iostream.h>
#include<iomanip.h>
main( )
{
char x,jenis[10];
int i,hrg,banyk_j,banyk_beli[100],j_hrg[10],j_bay=0;
long tot_bay;
float pajak;
pilihan:
clrscr();
cout<<"=============================="<<endl;
cout<<" RESTAURANT AYAM "<<endl;
cout<<"=============================="<<endl;
cout<<"A. Ayam Bakar Madu |"<<endl;
cout<<"B. Ayam Bakar Sambal Hijau |"<<endl;
cout<<"C. Ayam Goreng Crispy | "<<endl;
cout<<"D. Sup Ayam Ceker | "<<endl;
cout<<"E. Ayam Mercon Pedas |"<<endl;
cout<<"=============================="<<endl;
cout<<"\n";
cout<<"Input Banyak Menu : ";cin>>banyk_j;
cout<<endl;
for(i=1;i<=banyk_j;i++)
{
cout<<"Menu Ke - "<<i<<endl;
cout<<"Kode Menu [A/B/C/D/E] : ";cin>>jenis[i];
cout<<"Kuantiti/Porsi : ";cin>>banyk_beli[i];
cout<<endl;
}
cout<<endl;
cout<<" RESTAURANT AYAM 4307"<<endl;
cout<<"------------------------------------------------------------"<<endl;
cout<<"No. Menu Harga Kuantiti Jumlah"<<endl;
cout<<" Ayam Satu Porsi Porsi Harga"<<endl;
cout<<"------------------------------------------------------------"<<endl;
for(i=1;i<=banyk_j;i++)
{
cout<<setiosflags(ios::left)<<setw(5)<<i;
cout<<setiosflags(ios::left)<<setw(20);
if(jenis[i]=='A'||jenis[i]=='a')
{
cout<<"Ayam Bakar Madu";
cout<<setw(18)<< setiosflags(ios::left);
hrg=25000;
cout<<"25000";
}
else if (jenis[i]=='B'||jenis[i]=='b')
{
cout<<"Ayam Bakar S.Hijau";
cout<<setw(18)<< setiosflags(ios::left);
hrg=26000;
cout<<"26000";
}
else if (jenis[i]=='C'||jenis[i]=='c')
{
cout<<"Ayam Goreng Crispy";
cout<<setw(18)<< setiosflags(ios::left);
hrg=20000;
cout<<"20000";
}
else if (jenis[i]=='D'||jenis[i]=='d')
{
cout<<"Sup Ayam Ceker";
cout<<setw(18)<< setiosflags(ios::left);
hrg=15000;
cout<<"15000";
}
else if (jenis[i]=='E'||jenis[i]=='e')
{
cout<<"Ayam Mercon Pedas";
cout<<setw(18)<< setiosflags(ios::left);
hrg=27000;
cout<<"27000";
}
else
{
cout<<"Salah Kode";
cout<<setw(18)<< setiosflags(ios::left);
hrg=0;
cout<<"0";
}
cout<<setiosflags(ios::left)<<setw(8)<<banyk_beli[i];
j_hrg[i]= banyk_beli[i] * hrg;
cout<<"Rp "<<j_hrg[i]<<endl ;
j_bay= j_bay + j_hrg [i];
}
cout<<"------------------------------------------------------------"<<endl;
cout<< " \t\tJumlah Bayar Rp "<<j_bay<< endl ;
pajak = (j_bay*10)/100;
cout<< " \t\tPajak(10%) Rp "<<pajak<<endl;
tot_bay = j_bay+pajak;
cout<< " \t\tToyal Bayar Rp "<<tot_bay<<endl<<endl ;
cout<<"==================TERIMA KASIH================\t"<<endl<<endl;
c
cout<<"===========Selamat Berbelanja Kembali==========\t"<<endl<<endl;
cout<<"KEMBALI KE MENU AWAL [Y/X]??:";cin>>x;
if(x=='Y'||x=='y')
{
clrscr();
goto pilihan;
}
getch();
}
Komentar
Posting Komentar