Contoh Kodingan Sederhana Struk Toko Pizza C++


Whatsup Guys.,
Selamat Datang Diblog Saya ,.hehehe
Disini Saya Mau Ngeshare Sekilas Tentang Program sederhana Dari Bahasa C++ Nih,.
hmmm.,Yang Dulunya Mungkin Menjadi Tugas DiKampus Saya .

Langsung Ajh Ya ,.;-)


PROGRAM BUKTI STRUK TOKO PIZZA 


--------------------------------------------------------------------------------------------------------------------------

                            //file header
#include<stdio.h>
#include<conio.h>
#include<iostream.h>
main()
{
 //Tipe data
char np[20],kp,u,*napiz;
int jb,h,subtotal,tb,ub,uk;
float pot,ppn;
                        //input
cout<<"=======Toko Pizza Ngenah======"<<endl;
cout<<"Nama Pembeli      = ";gets(np);
cout<<"Kode Pizza[1/2/3] = ";cin>>kp;
cout<<"Ukuran[K/S/B]     = ";cin>>u;
cout<<"Jumlah Beli       = ";cin>>jb;

//proses
if(kp=='1')
{napiz="Meat Lover";
if(u=='K' || u=='k')
h=20000;
else if(u=='S' || u=='s')
h=30000;
else if(u=='B' || u=='b')
h=50000;
else
h=0;
}
else if(kp=='2')
{napiz="Suppreme";
if(u=='K' || u=='k')
h=25000;
else if(u=='S' || u=='s')
h=35000;
else if(u=='B' || u=='b')
h=55000;
else
h=0;
}
else if(kp=='3')
{napiz="Vegetarian";
if(u=='K' || u=='k')
h=30000;
else if(u=='S' || u=='s')
h=40000;
else if(u=='B' || u=='b')
h=60000;
else
h=0;
}
//output
clrscr();
cout<<"---------TOKO PIZZA NGENAH----------"<<endl;
cout<<"===================================="<<endl;
cout<<"Nama Pembeli      = "<<np<<endl;
cout<<"Kode Pizza[1/2/3] = "<<kp<<endl;
cout<<"Nama Pizza        = "<<napiz<<endl;
cout<<"Ukuran[K/S/B]     = "<<u<<endl;
cout<<"Harga Pizza       = Rp."<<h<<endl;
cout<<"Jumlah Beli       = "<<jb<<endl;
cout<<"================================"<<endl;

         //SUBTOTAL
subtotal=h*jb;
cout<<"Subtotal          = Rp. "<<subtotal<<endl;
if(jb>=5)
pot=0.3*subtotal;
else
pot=0;
cout<<"Potongan 30%      = Rp."<<pot<<endl;


                        //PPN
ppn=0.1*subtotal;
cout<<"PPN 10%           = RP. "<<ppn<<endl;


                       //TOTAL BAYAR
tb=subtotal-pot+ppn;
cout<<"Total Bayar       = RP."<<tb<<endl;
cout<<"================================"<<endl;
cout<<"Uang Bayar        = Rp. "; cin>>ub;
uk=ub-tb;
cout<<"Uang Kembalian    = Rp. "<<uk<<endl;
cout<<"================================"<<endl;
getch();

}

--------------------------------------------------------------------------------------------------------------------------
Selamat Mencoba,.
Semoga Bermanfaat yeeeeee.,

0 Komentar