Kasir Penjualan
Contoh kasir penjualan
Ini contoh Source Code kasir penjualan :
#include<stdio.h>
#define MAKS 10
struct pesanan{
int harga, pesan;
};
main()
{
int i=0,jml=0,jml_hrg,hargatot=0;
struct pesanan orang[MAKS];
char jenis,lagi;
printf("\t\t Toko Icha-Gerobak Fried Chicken\n");
printf("\t\t\tDAFTAR HARGA\n");
printf("---------------------------------------------------------\n");
printf("Kode\tJenis\tHarga Per Potong\n");
printf("D\tDada\tRp 5000,00\n");
printf("P\tPaha\tRp 4000,00\n");
printf("S\tSayap\tRp 3000,00\n\n");
printf("---------------------------------------------------------\n");
fflush(stdin);
printf("\tMasukkan Pesanan Anda = \n");
for(i=0;i<3;i++)
{
orang[i].pesan=0;
orang[i].harga=0;
}
i=0;
do
{
printf("Pesanan ke - %d\n",++i);
printf("Jenis [D/P/S] = ");
fflush(stdin);
scanf("%c",&jenis);
printf("Jumlah = ");
scanf("%d",&jml);
printf("Apakah Anda ingin memesan lagi [y/t] ? ");
fflush(stdin);
scanf("%c",&lagi);
printf("\n");
if(jenis=='D' || jenis=='d')
{
jml_hrg=jml*5000;
orang[0].pesan+=jml;
orang[0].harga+=jml_hrg;
}
else if(jenis=='P' || jenis=='p')
{
jml_hrg=jml*4000;
orang[1].pesan+=jml;
orang[1].harga+=jml_hrg;
}
else if(jenis=='S' || jenis=='s')
{
jml_hrg=jml*3000;
orang[2].pesan+=jml;
orang[2].harga+=jml_hrg;
}
}
while(lagi=='y'||lagi=='Y');
for(i=0;i<3;i++)
{
hargatot+=orang[i].harga;
}
printf("---------------------------------------------------------\n");
printf("\n\n");
printf("Nota Belanja Anda :\n\n");
printf("\t\t\tGEROBAK FRIED CHICKEN\n");
printf("============================================================\n");
printf("No\tJenis Potong\tHarga Satuan\tQty\tJumlah Harga\n");
printf("1\tDADA\t\tRp 5000,-\t%d\t%d\n",orang[0].pesan,orang[0].harga);
printf("2\tPAHA\t\tRp 4000,-\t%d\t%d\n",orang[1].pesan,orang[1].harga);
printf("3\tSAYAP\t\tRp 3000,-\t%d\t%d\n",orang[2].pesan,orang[2].harga);
printf("Jumlah bayar : Rp %d,-\n",hargatot);
printf("pajak : Rp %d,-\n",hargatot/10);
printf("total bayar : Rp %d,-\n",hargatot+hargatot/10);
printf("\n\t\t\t~ TERIMA KASIH ATAS KUNJUNGAN ANDA ~");
}
Output nya seperti ini :
0 komentar: