PROGRAM
PENJUALAN
#include"conio.h"
#include"iostream.h"
void main()
{
char kode[20];
char *nama;
int i,jumlah[20];
long totalharga=0,harga;
int data;
do{
gotoxy(3,2);cout<<"jumlah data :";cin>>data;
for(i=0;i<=data-1;i++){
clrscr();
gotoxy(3,2);cout<<"input data penjualan:";
gotoxy(3,3);cout<<"===================================================";
gotoxy(3,4);cout<<"kode barang :";cin>>kode[i];
gotoxy(3,5);cout<<"jumlah :";cin>>jumlah[i];
}
clrscr();
gotoxy(4,2);cout<<"laporan penjualan ";
gotoxy(4,3);cout<<"---------------------------------------------------------------------------";
gotoxy(4,4);cout<<" no
kode jumlah nama
harga totalharga ";
gotoxy(4,5);cout<<"---------------------------------------------------------------------------";
for(i=0;i<=data-1;i++){
gotoxy(6,6+i);cout<<i+1<<" "<<kode[i];
switch(kode[i])
{ case '1' :
harga=1500;nama="sabun";
break ;
case '2':
harga=11500;nama="Rinso";
break;
case '3':
harga=150;nama="sunslik";
break;
}
gotoxy(28,6+i);cout<<nama;
gotoxy(18,6+i);cout<<jumlah[i];
gotoxy(35,6+i);cout<<harga;
totalharga=harga*jumlah[i];
gotoxy(47,i+6);cout<<totalharga;
}
gotoxy(5,i+7);cout<<"---------------------------------------------";
getch();
}
while (kode[i]) ;
}
Tidak ada komentar:
Posting Komentar