Показать сообщение отдельно
  #8  
Старый 18.06.2010, 18:17
Black Raider Black Raider вне форума
Местный
 
Регистрация: 31.05.2010
Адрес: Москва
Сообщения: 466
Версия Delphi: 7
Репутация: 40
По умолчанию

только проверь формулы.
Код:
procedure TForm1.Button1Click(Sender: TObject);
var
x,a,h,s:extended;
begin
  x:=strtofloat(edit2.Text);
  if edit1.Text[1]='a' then begin
    a:=x;
    s:=sqrt(3)/4*x*x;
    h:=sqrt(x-(x/2));
  end;
  if edit1.Text[1]='s' then begin
    s:=x;
    a:=sqrt(3)/4/x/x;
    h:=sqrt(x-(x/2));
  end;
  if edit1.Text[1]='h' then begin
    h:=x;
    a:=sqrt(3)/4/x/x;
    s:=sqrt(3)/4*x*x;
  end;
  memo1.Lines.add('h='+floattostrf(h,fffixed,8,3)+' a='+floattostrf(a,fffixed,8,3)+' s='+floattostrf(s,fffixed,8,3));
end;
Ответить с цитированием