Listing Program C++ Penjualan Structure dengan Array dan Function

#include<conio.h>
#include<iostream.h>
#include<stdio.h>
#include<ctype.h>
#include<iomanip.h>

#define MAX_SPG 50

struct Spg {
char nama[30];
char nip[20];
long gaji,tunjangan;
int panci,oven,blender,ricecooker,mixer;
}spg[MAX_SPG];



void header();
int inputasi();
void report(int control);



void main()
{
clrscr();
int control=0;
control = inputasi();
report(control);
getch();
}


int inputasi()
{
int control =0;
char ulang ='y';

while(ulang =='y' && control !=MAX_SPG)
{
if(control!=MAX_SPG)
{
clrscr();
cout<<"                        PERUSAHAAN MAJU"<<endl;
cout<<"                    Program Komisi Salesman"<<endl;
cout<<"                      Tampilan input ke- "<<control+1<<endl;
cout<<"----------------------------------------------------------------------"<<endl;
cout<<"Nama              : ";gets(spg[control].nama);
cout<<"NIP               : ";gets(spg[control].nip);
cout<<"______________________________________________________________________"<<endl;
cout<<endl<<endl;
cout<<"Jumlah produk yang dijual "<<endl;
cout<<"--------------------------"<<endl;
cout<<"Panci       : ";cin>>spg[control].panci;
cout<<"Blender     : ";cin>>spg[control].blender;
cout<<"Oven        : ";cin>>spg[control].oven;
cout<<"Rice Cooker : ";cin>>spg[control].ricecooker;
cout<<"Mixer       : ";cin>>spg[control].mixer;
cout<<"--------------------------"<<endl;
control++;
}
else
{
clrscr();
cout<<"TIDAK BISA MENGINPUT SUDAH MELEBIHI BATAS MAXIMUM !!\n";
}

cout<<"Mau tambah lagi [Y/T] : ";ulang=getche(); flushall();
}
return(control);

}


void report(int control)
{
clrscr();
header();
for (int i=0;i<control;i++)
{
spg[i].gaji=((spg[i].panci*50000)+(spg[i].oven*250000)+(spg[i].blender*100000)+(spg[i].ricecooker*350000)+(spg[i].mixer*300000))*0.25;
spg[i].tunjangan=spg[i].gaji+100000;
gotoxy(2,6+i);cout<<i+1;
gotoxy(7,6+i);cout<<spg[i].nama;
gotoxy(20,6+i);cout<<spg[i].nip;
gotoxy(35,6+i);cout<<"Rp.";
gotoxy(38,6+i);cout<<spg[i].gaji<<endl;
gotoxy(50,6+i);cout<<"Rp.";
gotoxy(53,6+i);cout<<spg[i].tunjangan<<endl;
}
}

void header()
{
cout<<"                                 PROGRAM"<<endl;
cout<<"                           Jumlah Komisi Salesman"<<endl;
cout<<"====================================================================="<<endl;
gotoxy(2,4);cout<<"No.";
gotoxy(7,4);cout<<"Nama";
gotoxy(20,4);cout<<"NIP";
gotoxy(35,4);cout<<"Komisi"<<endl;
gotoxy(50,4);cout<<"Komisi+Tunjangan"<<endl;
cout<<"====================================================================="<<endl;
}
Previous
Next Post »