Tampilan akhir'a seperti ini
#include <iostream.h>
#include <iomanip.h>
#include <stdio.h>
#include <conio.h>
grs()
{puts("--------------------------------");}
garis()
{puts("-----------------------------------------------");}
main()
{
int i, x, bb[10];
float hg[10], jh[10], jb, pj, tb;
char lg, kd[10], *jp[10];
atas:
clrscr();
grs();
cout<<"| GEROBAK FRIED CHICKEN |"<<endl;
grs();
cout<<"|Kode | Jenis Potong | Harga |"<<endl;
grs();
cout<<"| D | Dada | Rp 2500 |"<<endl;
cout<<"| P | Paha | Rp 2000 |"<<endl;
cout<<"| S | Sayap | Rp 1500 |"<<endl;
grs();
cout<<endl;
cout<<"Banyak Jenis = ";cin>>x;
cout<<endl;
jb=0;
for(i=1;i<=x;i++)
{
cout<<"Jenis ke - "<<i<<endl;
cout<<"Kode Potong [D/P/S] : ";cin>>kd[i];
cout<<"Banyak Beli : ";cin>>bb[i];
cout<<endl;
if (kd[i]=='d'||kd[i]=='D')
{ jp[i]="Dada";
hg[i]=2500;}
else if (kd[i]=='p'||kd[i]=='P')
{ jp[i]="Paha";
hg[i]=2000;}
else if (kd[i]=='s'||kd[i]=='S')
{ jp[i]="Sayap";
hg[i]=1500;}
jh[i]=(hg[i]*bb[i]);
jb=jb+jh[i];
}
garis();
cout<<"| GEROBAK FRIED CHICKEN |"<<endl;
garis();
cout<<"|No.| Jenis | Harga | Banyak | Jumlah |"<<endl;
cout<<"| | Potong | Satuan | Beli | Harga | "<<endl;
garis();
for(i=1;i<=x;i++)
{
cout<<setiosflags(ios::left)<<"| "<<setw(2)<<i;
cout<<setiosflags(ios::left)<<"| "<<setw(8)<<jp[i];
cout<<setiosflags(ios::left)<<"| "<<setw(8)<<hg[i];
cout<<setiosflags(ios::left)<<"| "<<setw(8)<<bb[i];
cout<<setiosflags(ios::left)<<"| Rp "<<setw(7)<<jh[i]<<"|";
cout<<endl;
}
garis();
cout<<" Jumlah Bayar Rp "<<jb<<endl;
pj=jb*10/100;
cout<<" Pajak Rp "<<pj<<endl;
cout<<" _________+"<<endl;
tb=jb+pj;
cout<<" Total Bayar Rp "<<tb<<endl;
cout<<endl;
cout<<endl;
cout<<"Ingin Input Data Lagi [Y/T]? ";cin>>lg;
if(lg=='y' ||lg=='Y')
goto atas;
getch();
}
Tidak ada komentar:
Posting Komentar