Показать сообщение отдельно
  #1  
Старый 29.04.2011, 20:59
crazypiters crazypiters вне форума
Прохожий
 
Регистрация: 26.04.2011
Сообщения: 4
Репутация: 10
По умолчанию Как написать короче и оптимальнее

А можно ли сократить данный код?

Код:
procedure TForm2.RadioGroup7Click(Sender: TObject);
begin
if (RadioGroup1.ItemIndex=0)  and (RadioGroup2.ItemIndex=5) and (RadioGroup4.ItemIndex=0) and (RadioGroup5.ItemIndex=0) and (RadioGroup6.ItemIndex=4) and (RadioGroup7.ItemIndex=3) then a:=2.8;
if (RadioGroup1.ItemIndex=0)  and (RadioGroup2.ItemIndex=5) and (RadioGroup4.ItemIndex=0) and (RadioGroup5.ItemIndex=0) and (RadioGroup6.ItemIndex=7) and (RadioGroup7.ItemIndex=3) then a:=3.7;
if (RadioGroup1.ItemIndex=0)  and (RadioGroup2.ItemIndex=5) and (RadioGroup4.ItemIndex=0) and (RadioGroup5.ItemIndex=2) and (RadioGroup6.ItemIndex=4) and (RadioGroup7.ItemIndex=3) then a:=3.3;
if (RadioGroup1.ItemIndex=0)  and (RadioGroup2.ItemIndex=5) and (RadioGroup4.ItemIndex=0) and (RadioGroup5.ItemIndex=2) and (RadioGroup6.ItemIndex=7) and (RadioGroup7.ItemIndex=3) then a:=4.3;
if (RadioGroup1.ItemIndex=0)  and (RadioGroup2.ItemIndex=5) and (RadioGroup4.ItemIndex=1) and (RadioGroup5.ItemIndex=0) and (RadioGroup6.ItemIndex=5) and (RadioGroup7.ItemIndex=0) then a:=20.7;
if (RadioGroup1.ItemIndex=0)  and (RadioGroup2.ItemIndex=0) and (RadioGroup4.ItemIndex=0) and (RadioGroup5.ItemIndex=1) and (RadioGroup6.ItemIndex=4) and (RadioGroup7.ItemIndex=3) then a:=1;
if (RadioGroup1.ItemIndex=0)  and (RadioGroup2.ItemIndex=0) and (RadioGroup4.ItemIndex=0) and (RadioGroup5.ItemIndex=2) and (RadioGroup6.ItemIndex=4) and (RadioGroup7.ItemIndex=3) then a:=0.7;
if (RadioGroup1.ItemIndex=0)  and (RadioGroup2.ItemIndex=6) and (RadioGroup4.ItemIndex=0) and (RadioGroup5.ItemIndex=1) and (RadioGroup6.ItemIndex=7) and (RadioGroup7.ItemIndex=3) then a:=5.4;
if (RadioGroup1.ItemIndex=0)  and (RadioGroup2.ItemIndex=6) and (RadioGroup4.ItemIndex=0) and (RadioGroup5.ItemIndex=2) and (RadioGroup6.ItemIndex=7) and (RadioGroup7.ItemIndex=3) then a:=3.8;
end;
Ответить с цитированием