Autor Beitrag
GericasS
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 540

Windows Vista Home Premium
D2010, VisualStudio2008
BeitragVerfasst: Di 24.06.08 09:41 
Morgen =)

folgendes...

ich will wie im Titel genannt den Satz des Pythagoras umsetzten.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
procedure TForm1.Button4Click(Sender: TObject);
var
a,b,c,al,bt,ga : Real ;
begin
 begin
  a := StrToFloatDef(edit5.Text,0);
  b := StrToFloatDef(edit6.Text,0);
  c := StrToFloatDef(edit7.text,0);
 if (b>0) and (c>0) and (a<=0) then
  a := sqr(b)+sqr(c)-2*b*c*cos(al);
 end;
 begin
 if (c>0) and (a>0) and (b<=0)  then
  b := sqr(a)+sqr(c)-2*a*c*cos(bt);
 end;
 begin
 if (a>0) and (b>0) and (c<=0)  then
  c := sqr(a)+sqr(b)-2*a*b*cos(ga);
 end;
 Label36.Caption := FloatToStr(a);
 Label38.Caption := FloatToStr(b);
 Label40.Caption := FloatToStr(c);
end;

end.


Bei mir ist es der Fall, das die drei Winkel immer gegeben sind..nur iwie komm ich nicht dahinter mit diesem Bogenmaß..muss ich an den stellen wo cos etc steht mit dem RadToDeg arbeiten ?!
Weil die Ergebnisse nicht richtig sind =)

_________________
Alexander N.
Neue Bewaffnung Amilo xi2428 T9300
nagel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 708

Win7, Ubuntu 10.10

BeitragVerfasst: Di 24.06.08 09:46 
Komische begin-end-Struktur.

Wo werden die Werte für die Winkel gesetzt? Und im Grad- oder im Bogenmaß? Falls Grad, musst du bei cos noch DegToRad einfügen.
ZeitGeist87
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1593
Erhaltene Danke: 20

Win95-Win10
Delphi 10 Seattle, Rad Studio 2007, Delphi 7 Prof., C++, WSH, Turbo Pascal, PHP, Delphi X2
BeitragVerfasst: Di 24.06.08 09:48 
Mal n Formatierungsvorschlag:

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
procedure TForm1.Button4Click(Sender: TObject);
var a, b, c, al, bt, ga: Real;
begin
 a:= StrToFloatDef(edit5.Text,0);
 b:= StrToFloatDef(edit6.Text,0);
 c:= StrToFloatDef(edit7.text,0);
 
 if (b>0) and 
    (c>0) and 
    (a<=0) then
 begin
  a := sqr(b)+sqr(c)-2*b*c*cos(al);
 end;

 if (c>0) and 
    (a>0) and 
    (b<=0) then
 begin
  b := sqr(a)+sqr(c)-2*a*c*cos(bt);
 end;

 if (a>0) and 
    (b>0) and 
    (c<=0) then
 begin
  c := sqr(a)+sqr(b)-2*a*b*cos(ga);
 end;

 Label36.Caption:= FloatToStr(a);
 Label38.Caption:= FloatToStr(b);
 Label40.Caption:= FloatToStr(c);

end.

_________________
Wer Provokationen, Ironie, Sarkasmus oder Zynismus herauslesen kann soll sie ignorieren um den Inhalt meiner Beiträge ungetrübt erfassen zu können.