Contoh Membuat Program Penjualan dengan C++
M-S Blog || Contoh Membuat Program Penjualan dengan C++ || Berikut ini adalah script untuk Program Penjualan dengan C++
#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(17,1);cout << "---------------------------------------------------";
gotoxy(32,2);cout << "Muhammad-Sholeh.info";
gotoxy(17,3);cout << "---------------------------------------------------";
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,1);cout << "Laporam Data Penjualan Hal : ";
gotoxy(2,2);cout << "-------------------------------------------------------------------------------";
gotoxy(2,3);cout << "No|Kode|Nama Brg| Harga |Jumlah|Total Harga| Diskon | Total Pembayaran";
gotoxy(2,4);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 Brg| Harga |Jumlah|Total Harga| Diskon | Total Pembayaran";
gotoxy(2,5);cout << "----------------------------------------------------------------------------------";
}
br++;
gotoxy(2,7+j);cout << "-------------------------------------------------------------------------------";
}
# jika ada pertanyaan mengenai Contoh Membuat Program Penjualan dengan C++ silahkan berkomentar !
0 komentar:
Post a Comment