berikut ini adalah contoh program nota penjualan dengan bahasa c++


#include
#include
main()

long int jenis,kode[50],jumlah[50],tot[50],dibayar,harga[50];
int i=1;
float total[50],kembali;
char lagi;
tot[50]=0;
do

clrscr();
cout<<"_____________________________________________________________________"<cout<<" Nota Penjualan"<cout<<" Apotek FARMA MEDIKA"<cout<<"====================================================================="<cout<<" masukan jenis obat : ";cin>>jenis;
cout<<"====================================================================="<gotoxy(3,7);cout<<"no";
gotoxy(7,7);cout<<"kode barang";
gotoxy(20,7);cout<<"nama obat";
gotoxy(35,7);cout<<"harga";
gotoxy(45,7);cout<<"jumlah";
gotoxy(60,7);cout<<"total";
for(int a=1;a<=jenis;a++){
gotoxy(3,8+a);cout<gotoxy(7,8+a);cin>>kode[a];
switch(kode[a])
{
case 1:gotoxy(20,8+a);cout<<"bodrex";break;
case 2:gotoxy(20,8+a);cout<<"antangin";break;
case 3:gotoxy(20,8+a);cout<<"kukubima";break;
case 4:gotoxy(20,8+a);cout<<"extrajoss";break;
case 5:gotoxy(20,8+a);cout<<"tolak angin";break;
case 6:gotoxy(20,8+a);cout<<"ultra flu";break;
case 7:gotoxy(20,8+a);cout<<"mixagrip";break;
case 8:gotoxy(20,8+a);cout<<"promaag";break;
case 9:gotoxy(20,8+a);cout<<"neo reumacil";break;
case 10:gotoxy(20,8+a);cout<<"panadol";break;
default:gotoxy(20,8+a);cout<<"-";break;
}
switch(kode[a])
{
case 1:harga[a]=500.0;break;
case 2:harga[a]=1000.0;break;
case 3:harga[a]=1500.0;break;
case 4:harga[a]=2000.0;break;
case 5:harga[a]=1000.0;break;
case 6:harga[a]=500.0;break;
case 7:harga[a]=450.0;break;
case 8:harga[a]=500.0;break;
case 9:harga[a]=1000.0;break;
case 10:harga[a]=500.0;break;
default:harga[a]=0.0;break;
}
gotoxy(35,8+a);cout<gotoxy(45,8+a);cin>>jumlah[a];
total[a]=jumlah[a]*harga[a];
gotoxy(60,8+a);cout<gotoxy(1,9+jenis);cout<<"====================================================================="<}
for (b=1;b<=jenis;b++){
tot[i]=total[a]+tot[i];
gotoxy(45,10+jenis);cout<<"total bayar :";
gotoxy(60,10+jenis);cout<}
gotoxy(45,11+jenis);cout<<"dibayar :";
gotoxy(60,11+jenis);cin>>dibayar;
kembali=dibayar-tot[i];

gotoxy(45,12+jenis);cout<<"kembali :";
gotoxy(60,12+jenis);cout<cout<<"______________________________TERIMA KASIH___________________________"<cout<<"hitung lagi [y/t]: ";cin>>lagi;
i++;
}while(lagi=='y'||lagi=='Y');

getch();
return 0;
}..

0 comments: