Minggu, 19 Juni 2011

Contoh Program penjualan produk dengan C++

. Minggu, 19 Juni 2011

Berikut adalah contoh program penjualan produk menggunakan Bahasa Program C++

Ini adalah Source  nya



#include<conio.h>
#include<iostream.h>
#include<stdio.h>
#include<string.h>

struct barang{
int kode;
int jumlah;

} rbarang[40];

 void main(){
int i=0,j,br=0;
char lg;
int hal;
char nama [30];
long harga;
long total;
float diskon;
long tot;
do{
gotoxy(10,5);cout << "Input Data Penjualan";
gotoxy(10,6);cout << "====================";
gotoxy(10,7);cout << "Kode  : ";cin >> rbarang[i].kode;
gotoxy(10,8);cout << "Jumlah  : "; cin >> rbarang[i].jumlah;
gotoxy(10,9);cout << "Input lagi[Y/T]:";cin >> lg;
clrscr();i++;
} while(lg=='Y' || lg=='y');
gotoxy(2,2);cout << "Laporam Data Penjualan                                      Hal : ";
gotoxy(2,3);cout << "-------------------------------------------------------------------------------";
gotoxy(2,4);cout << "No Kode Nama Barang Harga Jumlah Total Harga Diskon    Total Pembayaran";
gotoxy(2,5);cout << "----------------------------------------------------------------------";
br=5;
for (j=0;j<i;j++){
switch(rbarang[j].kode){
case 1:
strcpy(nama,"TV");
harga=1000000;
break;
case 2:
strcpy(nama,"DVD");
harga=650000;
break;
case 3:
strcpy(nama,"CD ROOM");
harga=400000;
break;
default: strcpy,"--" ;harga=0;
}
gotoxy(2,6+j);cout << j+1 << "";gotoxy(5,6+j);cout << rbarang[j].kode << "";gotoxy(10,6+j);cout <<nama;
gotoxy(22,6+j);cout << "Rp.";gotoxy(25,6+j);cout << harga;
gotoxy(35,6+j);cout << rbarang[j].jumlah << " ";
total=harga*rbarang[j].jumlah;
gotoxy(40,6+j); cout << "Rp.";gotoxy(43,6+j);cout << total;
}
if (total >=1000000){
diskon=0.1*total;
}else{
diskon=0;
}
gotoxy(52,6+j);cout << "Rp.";gotoxy(55,6+j);cout << diskon;
tot=total-diskon;
gotoxy(62,6+j);cout << "Rp.";gotoxy(65,6+j);cout << tot;
if (br==10){
 br=5;
 lg=getch();
 hal++;
 clrscr();
gotoxy(2,2);cout << "Laporam Data Penjualan                                      Hal : " << hal;
gotoxy(2,3);cout << "----------------------------------------------------------------------";
gotoxy(2,4);cout << "No Kode Nama Barang Harga Jumlah Total Harga Diskon    Total Pembayaran";
gotoxy(2,5);cout << "----------------------------------------------------------------------";
}
br++;

gotoxy(2,7+j);cout << "-------------------------------------------------------------------------------";
 }

Gambar di bawah ini adalah contoh output dari pemilihan jenis barang:



Gambar dibawah ini adalah output dari kode barang yg telah di inputkan sebelumnya :

0 komentar:

:)) ;)) ;;) :D ;) :p :(( :) :( :X =(( :-o :-/ :-* :| 8-} :)] ~x( :-t b-( :-L x( =))

Posting Komentar

 
YOUR BLOG TITLE is proudly powered by o-om.com | Modif by BLOG Arychristian