#include <conio.h>
#include <stdio.h>#include <iostream.h>
#include <string.h>
#include <iomanip.h>
garis()
{
cout<<"=============================================================="<<endl;
}
judul()
{
cout<<" PENJUALAN LAPTOP "<<endl;
cout<<" INDOKOMPUTER "<<endl;
cout<<"*****************************************************************************"<<endl;
}
main()
{
int i,jd,ub,uk,tb=0;
char npt[15],npm[15],lagi;
struct
{
char kj,ml[15],*merk;
int j,harga;
}
laptop[15];
awal:
clrscr();
judul();
cout<<endl;
cout<<"NAMA PETUGAS:";gets(npt);
cout<<"NAMA PEMBELI:";gets(npm);
cout<<"JUMLAH DATA:";cin>>jd;
cout<<endl;
for(i=1;i<=jd;i++)
{
cout<<"Laptop ke-"<<i<<endl;
cout<<"Kode jenis laptop [A/C/T]= ";cin>>laptop[i].kj;
cout<<"Jumlah Beli= ";cin>>laptop[i].j;
cout<<endl;
}
clrscr();
judul();
cout<<endl;
cout<<"Nama Petugas: "<<npt<<endl;
cout<<"Nama Pembeli: "<<npm<<endl;
garis();
cout<<"No Kode Jenis Merk Harga Jumlah"<<endl;
cout<<" laptop laptop laptop beli"<<endl;
garis();
for(i=1;i<=jd;i++)
{
cout<<setiosflags(ios::left)<<setw(5)<<i;
if(laptop[i].kj=='A'||laptop[i].kj=='a')
{
laptop[i].merk="ASUS";
laptop[i].harga=4300000;
}
else if(laptop[i].kj=='C'||laptop[i].kj=='c')
{
laptop[i].merk="ACER";
laptop[i].harga=3500000;
}
else if(laptop[i].kj=='T'||laptop[i].kj=='t')
{
laptop[i].merk="TOSHIBA";
laptop[i].harga=5000000;
}
cout<<setiosflags(ios::left)<<setw(15)<<laptop[i].kj;
cout<<setiosflags(ios::left)<<setw(15)<<laptop[i].merk;
cout<<setiosflags(ios::left)<<setw(15)<<laptop[i].harga;
laptop[i].harga=laptop[i].harga*laptop[i].j;
tb=laptop[i].harga+tb;
cout<<setiosflags(ios::left)<<setw(15)<<laptop[i].j<<endl;
cout<<endl;
}
garis();
cout<<" Total Bayar Rp "<<tb<<endl;
cout<<" Uang Bayar Rp ";cin>>ub;
uk=ub-tb;
cout<<" Uang Kembali Rp "<<uk<<endl;
cout<<"Input Data Lagi?[Y/T]";cin>>lagi;
if(lagi=='Y'||lagi=='y')
goto awal;
else
goto akhir;
akhir:
getch();
}