Selasa, 18 September 2012

LAPORAN PENJUALAN : C ++

 #include “conio.h”
#include “iostream.h”
#include “string.h”
struct dataproduk{
int kode ;
int jumlah ;
}
recproduk[10] ;
void main() {
                   long harga ;
                   long tharga;
                   char pil ;
                   char nama[20];
int j, i=0 ;
pil=’Y’ ;
while(pil==’Y'||pil==’y'){
clrscr() ;
         gotoxy(30,4) ; cout<< “Masukkan Kode Produk[1,2,3]“  ;
         gotoxy(30,5) ; cout<< “—————————”  ;
         gotoxy(30,6) ; cout<< “Kode  : “  ; cin >> recproduk[i].kode ;
         gotoxy(30,7) ; cout<< “Jumlah: “  ; cin >> recproduk[i].jumlah ;
         gotoxy(30,9) ; cout<< “Input Data Lagi : “  ; pil = getch() ;
         i++ ;
}
clrscr() ;
                  gotoxy(2,2) ; cout<< “BY.ABDUL HAMIT LUBIS”  ;
                  gotoxy(2,3) ; cout<< “Laporan Penjualan”  ;
                  gotoxy(2,4) ; cout<< "=============================================”  ;
                  gotoxy(2,5) ; cout<< “No”;
                  gotoxy(5,5) ; cout<< “Kode”;
                  gotoxy(10,5) ; cout<< “Nama Produk”;
                  gotoxy(25,5) ; cout<< “Harga”;
                  gotoxy(35,5) ; cout<< “Jumlah”;
                  gotoxy(45,5) ; cout<< “Total Harga” ;
                  gotoxy(2,6) ; cout<< “===============================================”  ;
for(j=0 ; j<i ; j++){
if(recproduk[j].kode==1){
strcpy(nama,”KULCAS”) ;
harga = 1000000 ;
}else if(recproduk[j].kode==2){
strcpy(nama,”TV”) ;
harga = 750000 ;
}else if(recproduk[j].kode==3){
strcpy(nama,”CD-R”) ;
harga = 450000 ;
}else{
strcpy(nama,”—-”) ;
harga = 0 ;
}
                     tharga = harga * recproduk[j].jumlah ;
                     gotoxy(2,7+j) ; cout<< j+1 << “  ” << recproduk[j].kode ;
                     gotoxy(10,7+j) ; cout<< nama  ;
                     gotoxy(25,7+j) ; cout<< harga ;
                     gotoxy(38,7+j) ; cout<< recproduk[j].jumlah;
                   gotoxy(45,7+j) ; cout<< tharga;
}
gotoxy(2,8+j) ; cout<< “—————————————————————————–”  ;

                     Cuman ni yang mampu saya abay kan pak semoga bapk dapt nilai nya dengan apa adanya amin.......by        nama  : abdul hamit

Tidak ada komentar:

Posting Komentar