Software Database Toko dengan c++

Posted: 9 April 2012 in Uncategorized
Tag:, , , ,

berikut penulis membuat sebuah contoh program yang berguna untuk membuat database toko, berdasarkan dari tugas yang diberikan oleh dosen sehingga ketemulah seperti berikut:

 

#include <stdio.h>
masukan(int byk_jns_brg, int jml_brg, int bonus, int tot, int i, char nm_jns_brg)
{
printf(“Banyak Jenis Barang \t: “);
scanf(“%d”, &byk_jns_brg);
i=1;
do
{
printf(“\nNama Jenis Barang \t: “);
scanf(“%s”, &nm_jns_brg);
printf(“Jumlah Barang \t\t: “);
scanf(“%d”, &jml_brg);
if (jml_brg > 500)
bonus=10;
else
bonus=0;
printf(“Bonus Barang \t\t: %d\n”, bonus);
tot = jml_brg+bonus;
printf(“Total Jumlah Barang \t: %d\n”, tot);
printf(“\n”);
i++;
}
while (i<=byk_jns_brg);
return 0;
}

tabel(char nm_jns_brg, int byk_jns_brg, int jml_brg, int bonus, int tot, int i)
{
printf (“\n======================================================\n”);
printf(“Jenis Barang\t Banyak Barang\t\t Bonus\t Total\n”);
printf (“======================================================\n”);
for (i=1; i<=byk_jns_brg; i++)
{
printf (“%c\t\t %d\t %d\t %d”, nm_jns_brg, jml_brg, bonus, tot);
printf (“\n”);
}
printf (“======================================================\n”);
return 0;
}

main()
{
int menu;
printf(”          MENU BONUS           \n”);
printf(“===============================\n”);
printf(“1. Masukan Jenis Barang\n”);
printf(“2. Tampilan Tabel\n”);
printf(“Pilih Menu [1-2] : “);
scanf(“%d”, &menu);
switch(menu)
{
case 1 :
{
masukan(0,0,0,0,0,’ ‘);
break;
}
case 2 :
{
tabel(‘ ‘,0,0,0,0,0);
break;
}
}

return 0;
}

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s