Моделировать работу системы автоматизации проектирования в течение 6 часов, страница 3

                                    taskret2=-1;

                                    event[1]=event[k];

                                    for(int u=1;u<aindex;u++)

                                    {

                                    a[u-1]=a[u];

                                    a1[u-1]=a1[u];

                                    }

                                    aindex--;

                                    for(u=0;u<3;u++)

                                    if(event[u]<event[k]) event[u]=event[k];

                               } else

                                    {

                                    fprintf(out,"время t=%f ЭВМ вырабатывает ответ на строку %d от 2 терминала\n",event[k],a[0]);

                                    taskret2=a[0];

                                    event[k]+=(double)3;

                                    possibility+=event[k];

                                    event[1]=event[k];

                                    for(int u=1;u<aindex;u++)

                                    {

                                    a[u-1]=a[u];

                                    a1[u-1]=a1[u];

                                    }

                                    aindex--;

                                    }

                          break;

                        }

            if(a1[0]==3)

                        {

                        if(a[0]==10)

                               {

                                    fprintf(out,"время t=%f ЭВМ начала решать задание от 3 терминала\n",event[k]);

                                    event[k]+=(double)7+(double)6*generate();

                                    possibility+=event[k];

                                    fprintf(out,"время t=%f ЭВМ решила задание от 3 терминала\n",event[k]);

                                    taskret3=-1;

                                    event[2]=event[k];

                                    for(int u=1;u<aindex;u++)

                                    {

                                    a[u-1]=a[u];

                                    a1[u-1]=a1[u];

                                    }

                                    aindex--;

                                    for(u=0;u<3;u++)

                                    if(event[u]<event[k]) event[u]=event[k];

                                    }

                               else

                                    {

                                    fprintf(out,"время t=%f ЭВМ вырабатывает ответ на строку %d от 3 терминала\n",event[k],a[0]);

                                    taskret3=a[0];

                                    event[k]+=(double)3;

                                    event[2]=event[k];

                                    possibility+=event[k];

                                    for(int u=1;u<aindex;u++)

                                    {

                                    a[u-1]=a[u];

                                    a1[u-1]=a1[u];

                                    }

                                    aindex--;

                                    }

                          break;

                        }

             }

             else

             {

            fprintf(out,"время t=%f ЭВМ ожидает\n",event[k]);

            double w=event[findmin(event,3)];

            wait+=w-event[k];

            event[k]=w;

             }

            break;

            }

  }

 }

fprintf(out,"загрузка ЭВМ равна %f\n",((double)21600-wait)/(double)21600);

fprintf(out,"вероятность простоя проектировщика равна %f\n",((double)21600-possibility)/(double)21600);

}

void main(void)