Rabu, 29 April 2009

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

#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<}

void line(int x, int y){

gotoxy(x,y);

cout<<"|"<}

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

cout<<"Inputkan"< cout<<"--------"< 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<<" =^=^=^=^=^=^=^=^=^=^=^=^=^=^="< cout<<" | Program Simulasi Inventoris |"< cout<<" ============================="< cout< 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 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 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

1 komentar:

PT IT Solution mengatakan...

bos dimasukin juga donk cara buat databasenya... maklum amatiran

Template by : kendhin x-template.blogspot.com