Показать сообщение отдельно
  #1  
Старый 18.11.2007, 20:24
Иринкаа Иринкаа вне форума
Прохожий
 
Регистрация: 11.11.2007
Сообщения: 20
Репутация: 10
По умолчанию Проблемы с циклом

Код:
if Edit2.Text='3' then
   repeat
    Vremya_tekyshee:= Vremya_tekyshee+Delt_m;
    Kol_post:= Kolichestvo(lmbd/5);
    Kl5_post:= Kl5_post+1;
    Edit13.Text:= IntToStr(Kl5_post);
    Randomize;
        if ((Kl1_ochered < Kl2_ochered) and (Kl1_ochered < Kl3_ochered)) or ((Kl1_ochered = Kl2_ochered) and (Kl1_ochered = Kl3_ochered))  then
       begin
        Kl1_ochered:= Kl1_ochered+Kol_post;
        if Kl1_ochered > 0 then
          begin
           if Vremya_tekyshee > Vremya_obsl1 then
             begin
              Kl1_post:= Kl1_post + 1;
              Kl1_ochered:= Kl1_ochered - 1;
              Edit8.Text:= IntToStr(Kl1_post);
              Vr_obsl1:= Vremya_obslugivania(StrToInt(Edit3.Text)/Scale, 15/Scale);
              Vr_obsl2:= Vremya_obslugivania(StrToInt(Edit4.Text)/Scale, 20/Scale);
              Vremya_obsl1:= Vr_obsl1 + Vr_obsl2 + Vremya_tekyshee;
             end;
          end;
       end;
      if (Kl2_ochered < Kl1_ochered) and (Kl2_ochered < Kl3_ochered) then
       begin
        Kl2_ochered:= Kl2_ochered+Kol_post;
        if Kl1_ochered > 0 then
          begin
            if Vremya_tekyshee > Vremya_obsl2 then
              begin
               Kl2_post:= Kl2_post + 1;
               Kl2_ochered:= Kl2_ochered - 1;
               Edit9.Text:= IntToStr(Kl2_post);
               Vr_obsl1:= Vremya_obslugivania(StrToInt(Edit3.Text)/Scale, 15/Scale);
               Vr_obsl2:= Vremya_obslugivania(StrToInt(Edit4.Text)/Scale, 20/Scale);
               Vremya_obsl2:= Vr_obsl1 + Vr_obsl2 + Vremya_tekyshee;
              end;
          end;
        end;
        if (Kl3_ochered < Kl1_ochered) and (Kl3_ochered < Kl2_ochered) then
       begin
        Kl3_ochered:= Kl3_ochered+Kol_post;
        if Kl3_ochered > 0 then
          begin
            if Vremya_tekyshee > Vremya_obsl3 then
              begin
               Kl3_post:= Kl3_post + 1;
               Kl3_ochered:= Kl3_ochered - 1;
               Edit10.Text:= IntToStr(Kl3_post);
               Vr_obsl1:= Vremya_obslugivania(StrToInt(Edit3.Text)/Scale, 15/Scale);
               Vr_obsl2:= Vremya_obslugivania(StrToInt(Edit4.Text)/Scale, 20/Scale);
               Vremya_obsl3:= Vr_obsl1 + Vr_obsl2 + Vremya_tekyshee;
              end;
          end;
        end;
   until Vremya_tekyshee > Vr_mashin_obsh;

Подскажите, плиз, почему 2-е и 3-е не выполняется, а именно
Код:
if (Kl2_ochered < Kl1_ochered) and (Kl2_ochered < Kl3_ochered) then
и
Код:
if (Kl3_ochered < Kl1_ochered) and (Kl3_ochered < Kl2_ochered) then

а заходит только в 1-е условие
Код:
if ((Kl1_ochered < Kl2_ochered) and (Kl1_ochered < Kl3_ochered)) or ((Kl1_ochered = Kl2_ochered) and (Kl1_ochered = Kl3_ochered))  then

Хотя при правильном выполнении, должны выполняться по очереди все условия.
Ответить с цитированием