Skip to content

Contoh program inventori dengan demand, time demand dan selang order random dengan C++

April 29, 2009

#include

#include

#include

#include

#include

void view(int item, int x, int y){

if (item<10)

gotoxy(x,y);

else

gotoxy(x-1,y);

cout<<item<<endl;

}

void line(int x, int y){

gotoxy(x,y);

cout<<"|"<<endl;

}

void inputan(int *sMi, int *sMa, int *sNo,int *tSi, int *a1, int *b1, int *n1, int *men1, int *men2){

cout<<"Inputkan"<<endl;

cout<<"——–"<<endl;

cout<<" Stok minimal : ";

cin>>*sMi;

cout<<" Stok maksimal : ";

cin>>*sMa;

cout<<" Stok sekarang : ";

cin>>*sNo;

cout<<" Lama simulasi : ";

cin>>*tSi;

cout<<" Maksimal beli (besar demand maksimal) : ";

cin>>*a1;

cout<<" Minimal beli (besar demand minimal) : ";

cin>>*b1;

cout<<" Banyak demand yang datang : ";

cin>>*n1;

cout<<" Rata – rata waktu antar kedatangan demand : ";

cin>>*men1;

cout<<" Rata – rata selang waktu datang order : ";

cin>>*men2;

}

void main(){

ulang:

clrscr();

int sMin,sMax,sNow,tSim,a,b,Stok,cDem = 0,n,mean1,mean2;

cout<<" =^=^=^=^=^=^=^=^=^=^=^=^=^=^="<<endl;

cout<<" | Program Simulasi Inventoris |"<<endl;

cout<<" ============================="<<endl;

cout<<endl;

inputan(&sMin,&sMax,&sNow,&tSim,&a,&b,&n,&mean1,&mean2);

typedef struct{

int value;

int iTime;

int tSent;

int tWait;

bool sent;

}id_demand;

int waktu;

id_demand demand[50];

int demCome;

float u,ran;

randomize();

for (int i=0; i<n; i++){

do{

u = ((rand() % 10));

}while(u==0);

ran = u/10;

waktu = -1 * mean1 * log10(ran);

if (i==0){

demand[i].iTime = waktu;

}

else{

demand[i].iTime = demand[i-1].iTime + waktu;

}

demand[i].value = a + (b-a)*ran;

}

for (int j=0; j<n; j++){

demand[j].sent = false;

}

int vOrder = 0;

int t=0;

bool order = false;

int i = 0;

int y = 16 + n;

int y2 = 8;

int dem,sDemWait = 0,tOrder,demSent,demWait,xtOrder = 0;

Download source code lengkap nya di sini

One Comment
  1. PT IT Solution permalink

    bos dimasukin juga donk cara buat databasenya… maklum amatiran

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: