#include
#include
#include
#include
main()
{
char jp[50]; //Jenis HP [A/S/D]
char *jns[50]; //Teksnya "Astro401"
double hrg[50],ttl[50]; //Harga dan total
double jb=0,pjk,tb; //Jumlah beli,Pajak, Total bayar
int i,j,bp[50]; //I dan J untuk perulangan
clrscr();
cout<<" IMOBILE "<
cout<<"-----------------------------------------------"<
cout<<" Kode Jenis HP Harga "<
cout<<"-----------------------------------------------"<
cout<<" A Astro401 Rp. 499.000 "<
cout<<" S Snow20i Rp. 959.000 "<
cout<<" D Diamond2010 Rp. 1.459.000 "<
cout<<"----------------------------------------"<
cout<<" Jumlah HP yang dibeli : "; cin>>j;
for(i=1;i<=j;++i) //awal perulangan
{
cout<
cout<<" Jenis Ke - "< jp:
cout<<" Jenis HP [A/S/D] : "; cin>>jp[i];
if(jp[i]=='A' || jp[i]=='a') //Proses
{ jns[i]="Astro401"; hrg[i]=499000; }
else if(jp[i]=='S' || jp[i]=='s')
{ jns[i]="Snow20i"; hrg[i]=959000; }
else if(jp[i]=='D' || jp[i]=='d')
{ jns[i]="Diamond2010"; hrg[i]=1459000; }
else
{ goto jp; }
cout<<" Banyak Beli : "; cin>>bp[i];
}
clrscr(); //Tampilan Output
cout<<" IMOBILE "<
cout<<"------------------------------------------------------"<
cout<<" No Jenis Harga Banyak Jumlah "<
cout<<" HP Satuan Beli Harga "<
cout<<"------------------------------------------------------"<
for(i=1;i<=j;++i)
{
cout<
gotoxy(3,9+i); cout<
gotoxy(10,9+i); cout<
gotoxy(24,9+i); cout<
gotoxy(42,9+i); cout<
ttl[i]=bp[i]*hrg[i];
gotoxy(48,9+i); cout<
cout<
jb=jb+ttl[i];
}
cout<
cout<<"------------------------------------------------------"<
cout<<" Jumlah Bayar : Rp. "<
pjk=jb*0.1 ;
cout<<" Pajak 10 % : Rp. "<
tb=jb+pjk;
cout<<" Total Bayar : Rp. "<
getch();
}
0 komentar