Jawaban Lat Fungsi array

#include<conio>
#include<iostream>
#include<iomanip>

int diskon(int c)//diskon
{return(0.1*c);}
int ppn(int d)//ppn
{return(0.05*d);}
int jumbay(int e,int f,int g)//jumbay
{return(e-f+g);}
int totbayar(int x,int y)//totbayar
{return(x+y);}
main()
{
char nmp[25],kd[3][20],*nmb[20],lagi;
int i,j,hrg[20],jb[20],byr[20],pjk[20],pot[20],jml[20],tb=0;
awal:
clrscr();
cout<<"
PROGRAM PENJUALAN AKSESORIS KOMPUTER"<<endl;
cout<<"
BLINKZ KOMP ACS"<<endl;
cout<<"Jl. www.fayblinkz.tk No. 15 Telp. (021) 91990468
Jakarta"<<endl;
cout<<"===================================================="<<endl;
cout<<"Masukan Nama Pembeli
: ";cin>>nmp;
cout<<"Masukan Jumlah Data
: ";cin>>j;
for(i=1;i<=j;i++)
{
cout<<endl;
cout<<"Data Ke- "<<i<<endl;
cout<<"Kode [KY/MS/CS]
: ";cin>>kd[i];
if(strcmp(kd[i],"KY")==0||strcmp(kd[i],"ky")==0)
{
nmb[i]="Keyboard";
hrg[i]=12500;
}
else if(strcmp(kd[i],"MS")==0||strcmp(kd[i],"ms")==0)
{
nmb[i]="Mouse";
hrg[i]=10000;
}
else
{
nmb[i]="Casing";
hrg[i]=15000;
}
cout<<"Nama Barang
: "<<nmb[i]<<endl;
cout<<"Harga Barang
: "<<hrg[i]<<endl;
cout<<"Masukan Jumlah Beli : ";cin>>jb[i];
byr[i]=bayar(hrg[i],jb[i]);
cout<<"Bayar
: Rp. "<<byr[i]<<endl;

Created By F@Y

www.fayblinkz.tk

int bayar(int a,int b)//bayar
{return(a*b);}

Jawaban Lat Fungsi array

}
clrscr();
cout<<endl;
cout<<"
LAPORAN PROGRAM PENJUALAN AKSESORIS KOMPUTER"<<endl;
cout<<"
ABC KOMP ACS"<<endl;
cout<<"Jl. Wolter Monginsidi No. 155
Telp. (021) 1234567
Jakarta"<<endl;
cout<<"========================================================"<<endl;
cout<<"Nama Pembeli
: "<<nmp<<endl;
cout<<"========================================================"<<endl;
cout<<"No Kode
Nama
Harga
Jumlah
Bayar
Diskon
PPN
Jumlah"<<endl;
cout<<"
Barang
Beli
Bayar"<<endl;
cout<<"========================================================"<<endl;
for(i=1;i<=j;i++)
{
cout<<setiosflags(ios::left)<<setw(4)<<i;
cout<<setiosflags(ios::left)<<setw(6)<<kd[i];
cout<<setiosflags(ios::left)<<setw(8)<<nmb[i];
cout<<setiosflags(ios::left)<<setw(10)<<hrg[i];
cout<<setiosflags(ios::left)<<setw(12)<<jb[i];
cout<<setiosflags(ios::left)<<setw(6)<<byr[i];
cout<<setiosflags(ios::left)<<setw(8)<<pot[i];
cout<<setiosflags(ios::left)<<setw(10)<<pjk[i];
cout<<setiosflags(ios::left)<<setw(12)<<jml[i]<<endl;
}
cout<<"========================================================"<<endl;
cout<<"
T A L
B A Y A R
:
Rp. "<<tb<<endl;
cout<<"========================================================"<<endl;
cout<<"Mau Input Lagi [Y/T] = ";cin>>lagi;
if(lagi=='Y'||lagi=='y')
goto awal;
else
goto akhir;
akhir:
getch();
}

Created By F@Y

www.fayblinkz.tk

pot[i]=diskon(byr[i]);
cout<<"Diskon
: Rp. "<<pot[i]<<endl;
pjk[i]=ppn(byr[i]);
cout<<"PPN
: Rp. "<<pjk[i]<<endl;
jml[i]=jumbay(byr[i],pot[i],pjk[i]);
tb=totbayar(jml[i],tb);
cout<<endl;