Borland C++ Tipe C


#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<iomanip.h>
char *napak(char kode[6])
{
if(!strcmp(kode,”B-01″))
{return “Cheese Burger”;}
else if(!strcmp(kode,”B-02″))
{return “Beef Burger”;}
else if(!strcmp(kode,”B-SPC”))
{return “Special Burger”;}
else if(!strcmp(kode,”P-M”))
{return “Pizza Medium Size”;}
else if(!strcmp(kode,”P-S”))
{return “Pizza Small Size”;}
else if(!strcmp(kode,”P-SPC”))
{return “Special Pizza”;}
else if(!strcmp(kode,”D-C”))
{return “Soft Drink Cola”;}
else if(!strcmp(kode,”D-J”))
{return “Soft Drink Juice”;}
}

long int hrg(char kode[6])
{
if(!strcmp(kode,”B-01″))
{return 5500;}
else if(!strcmp(kode,”B-02″))
{return 7500;}
else if(!strcmp(kode,”B-SPC”))
{return 11000;}
else if(!strcmp(kode,”P-M”))
{return 24000;}
else if(!strcmp(kode,”P-S”))
{return 9000;}
else if(!strcmp(kode,”P-SPC”))
{return 75500;}
else if(!strcmp(kode,”D-C”))
{return 4500;}
else if(!strcmp(kode,”D-J”))
{return 3500;}
}

main()
{
struct
{
char kode[6];
int jumbel;
long int tohar;
}bp[10];
float subtotal=0,ppn,grand,bayar,kembali;
int i,j;
char nota;

clrscr();
cout<<“====================================================”<<endl;
cout<<”           SERDAM BURGER & PIZZA”<<endl;
cout<<“====================================================”<<endl;
cout<<“No. Nota              : “;cin>>nota;
cout<<“Jumlah Transaksi      : “;cin>>j;
for(i=1;i<=j;i++)
{
cout<<endl;
cout<<“Transaksi Ke-“<<i<<endl;
cout<<“Kode Paket         : “;cin>>bp[i].kode;
cout<<“Nama Paket         : “<<napak(bp[i].kode)<<endl;
cout<<“Harga Satuan       : “<<hrg(bp[i].kode)<<endl;
cout<<“Jumlah Beli        : “;cin>>bp[i].jumbel;
bp[i].tohar=hrg(bp[i].kode)*bp[i].jumbel;
cout<<“Total Harga        : “<<bp[i].tohar;
subtotal=subtotal+bp[i].tohar;
ppn=0.1*subtotal;
grand=subtotal+ppn;
}
clrscr();
cout<<“====================================================”<<endl;
cout<<“No. Kode  Nama               Harga  Jumlah  Total”<<endl;
cout<<”    Paket Paket              Satuan Beli”<<endl;
cout<<“====================================================”<<endl;
for(i=1;i<=j;i++)
{
cout<<setiosflags(ios::left)<<setw(4)<<i;
cout<<setiosflags(ios::left)<<setw(6)<<bp[i].kode;
cout<<setiosflags(ios::left)<<setw(19)<<napak(bp[i].kode);
cout<<setiosflags(ios::left)<<setw(7)<<hrg(bp[i].kode);
cout<<setiosflags(ios::left)<<setw(8)<<bp[i].jumbel;
cout<<setiosflags(ios::left)<<setw(5)<<bp[i].tohar<<endl;
}
cout<<“==================================================”<<endl;
cout<<”                         Subtotal  :Rp.”<<subtotal<<endl;
cout<<”                          PPN 10%  :Rp.”<<ppn<<endl;
cout<<”                      Grand Total  :Rp.”<<grand<<endl;
cout<<”                            Bayar  :Rp.”;cin>>bayar;
kembali=bayar-grand;
cout<<”                        Kembalian  :Rp.”<<kembali;
getch()
}

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: