Моделирование процесса обработки на участке 400 шестерен, страница 4

               if (jj==26) {kk26=z2+xx26; uu1=26;};

               if (jj==27) {kk27=z2+xx27; uu1=27;};

               if (jj==28) {kk28=z2+xx28; uu1=28;};

               if (jj==29) {kk29=z2+xx29; uu1=29;};

               if (jj==30) {kk30=z2+xx30; uu1=30;};

               if (jj==31) {kk30=z2+xx31; uu1=31;};   */

               if (fz2==1) {s2++;};

               if (fz2!=1) {fz2=1;};

       };

   };

/*if (ii>30)

   {

    ii=ii-15;       //smes'henie

    jj=jj-15;

    uu1=uu1-15;

    xx1=xx16;

    xx2=xx17;

    xx3=xx18;

    xx4=xx19;

    xx5=xx20;

    xx6=xx21;

    xx7=xx22;

    xx8=xx23;

    xx9=xx24;

    xx10=xx25;

    xx11=xx26;

    xx12=xx27;

    xx13=xx28;

    xx14=xx29;

    xx15=xx30;

    xx16=xx31;

    kk1=kk16;

    kk2=kk17;

    kk3=kk18;

    kk4=kk19;

    kk5=kk20;

    kk6=kk21;

    kk7=kk22;

    kk8=kk23;

    kk9=kk24;

    kk10=kk25;

    kk11=kk26;

    kk12=kk27;

    kk13=kk28;

    kk14=kk29;

    kk15=kk30;

    kk16=kk31;

   };              

d1=0;

if (z3==0)

   {

    if (e3>0)

       {

               e3--;

               z3=rnd_exp(10,6,0.1);

               if (fz3==1) {s1++;};

               if (fz3!=1) {fz3=1;};

       };

   };

//grafica

putpixel(100+t/9.1,440-s1,14);

putpixel(100+t/9.1,440-s2,12);

if (t_post>0) {t_post--;};

if (c1>0) {c1--;};

if (z1>0) {z1--;};

if (z3>0) {z3--;};

if (c2>0) {c2--;};

if (z2>0) {z2--;};

t++;

if ((s1+s2)==400) {goto FINISH;};

if (t==5000) {goto FINISH;};

goto START;

FINISH:

gotoxy(67,29); cout<<t;

getch();

}

int rnd_exp(double a, double b, double L)

               {

                ++b;

                double fd=10000;

                double k=exp(0)-exp(-L);

               Q:

                double c=random(b);

                double d=random(fd)/fd;

                double p=exp(-L*(c))-exp(-L*(c+1));

                if (d<=p/k)

                              if (random(2)==1) return(c+a);

                              else {if (c==0) goto Q;

                                    else return (-c+a);};

                goto Q;

               }

Текст программы имитирующей работу объекта во времени после оптимизации

#include <iostream.h>

#include <graphics.h>

#include <fstream.h>

#include <conio.h>

#include <STDLIB.H>

#include <stdio.h>

#include <math.h>

#include <dos.h>

void main()

{int dr = DETECT, mod =1;initgraph (&dr,&mod,"");

setcolor(15);

//gorizontali

for (int gor=0; gor<10; gor++)

    {

     line(100,40+gor*50,550,40+gor*50);

     gotoxy(10,4+gor*6); cout<<(4-gor)*100;

    };

//verticali

for (int ver=0; ver<10; ver++)

    {

     line(100+ver*50,40,100+ver*50,440);

    };

setcolor(14);

line(560,200,580,200);

setcolor(12);

line(560,250,580,250);

setcolor(15);

outtextxy(200,20,"Raspredelenie produkcii");

outtextxy(585,197,"1_sort");

outtextxy(585,247,"2_sort");

outtextxy(350,450,"Vremya,min");

outtextxy(2,220,"Kolichestvo,");

outtextxy(30,230,"shtuk");

int x1=0, x2=0, x3=0, x4=0, x5=0, x6=0, x7=0, x8=0, x9=0, x10=0;

int x11=0,x12=0,x13=0,x14=0,x15=0,x16=0,x17=0,x18=0,x19=0,x20=0;

int x21=0,x22=0,x23=0,x24=0,x25=0,x26=0,x27=0,x28=0,x29=0,x30=0,x31=0;

int k1=0, k2=0, k3=0, k4=0, k5=0, k6=0, k7=0, k8=0, k9=0, k10=0;

int k11=0,k12=0,k13=0,k14=0,k15=0,k16=0,k17=0,k18=0,k19=0,k20=0;

int k21=0,k22=0,k23=0,k24=0,k25=0,k26=0,k27=0,k28=0,k29=0,k30=0,k31=0;

int u1=0;

int k=0;

int xx1=0, xx2=0, xx3=0, xx4=0, xx5=0, xx6=0, xx7=0, xx8=0, xx9=0, xx10=0;

int xx11=0,xx12=0,xx13=0,xx14=0,xx15=0,xx16=0,xx17=0,xx18=0,xx19=0,xx20=0;

int xx21=0,xx22=0,xx23=0,xx24=0,xx25=0,xx26=0,xx27=0,xx28=0,xx29=0,xx30=0,xx31=0;

int kk1=0, kk2=0, kk3=0, kk4=0, kk5=0, kk6=0, kk7=0, kk8=0, kk9=0, kk10=0;

int kk11=0,kk12=0,kk13=0,kk14=0,kk15=0,kk16=0,kk17=0,kk18=0,kk19=0,kk20=0;

int kk21=0,kk22=0,kk23=0,kk24=0,kk25=0,kk26=0,kk27=0,kk28=0,kk29=0,kk30=0,kk31=0;

int uu1=0;

int kk=0;

int s1=0,s2=0;

int rnd_exp(double a, double b, double L);

int t_post=rnd_exp(10,5,0.1);

int e1=0, e2=0;

int ez1=0,ez2=0,e3=0;

int nb=0;

int c1=0, c2=0;

int z1=0, z2=0, z3=0;

int i=15, j=15, r=0;

int ii=15,jj=15,rr=0;

int fc1=0,fc2=0;

int fz1=0,fz2=0,fz3=0;