Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi inkompatible typen (https://www.delphipraxis.net/31672-inkompatible-typen.html)

Durg 12. Okt 2004 15:53


inkompatible typen
 
Hallo,
hab mal nen kleinen pq-formel rechner angefangen.
Ich hab aber das problem das er mir Inkompatible Typen als fehler anzeigt mehr nicht hier mal nen bisschen Code:

Code:
procedure TForm1.BtRechnenClick(Sender: TObject);
var
a, p, q, x1, x2, radikand: real;
begin
  A := StrToFloat(EdA.Text);
  P := StrToFloat(EdP.Text);
  Q := StrToFloat(EdQ.Text);
  radikand := sqr(p/2)-q;
    if radikand > '0' then
      begin
        EdComment.Text := 'Es gibt 2 Ergebnise';
        x1 := -(p/2) + sqrt(radikand);
        x2 := -(p/2) - sqrt(radikand);
      end
    else if radikand = '0' then
      begin
        EdComment.Text := 'Es gibt nur 1 Ergebnis';
        x1 := -(p/2) + sqrt(radikand);
        x2 := -(p/2) - sqrt(radikand);
      end
    else if radikand < '0' then
      begin
        EdComment.Text := 'Es gibt keine Ergebnise';
      end;
    Edx1.Text := FloatToStr(x1);
  Edx2.Text := FloatToStr(x2);
end;
Der fehler wird mir nach allen Thens angezeigt, was ist falsch??

sakura 12. Okt 2004 15:54

Re: inkompatible typen
 
Nimm mal die Hochkommata um die 0-en weg. Damit machst Du aus denen Strings, Du willst aber Zahlen vergleichen ;)

...:cat:...

Durg 12. Okt 2004 16:05

Re: inkompatible typen
 
Ich depp, heute morgen noch richtig gemacht und jetzt falsch :wall: .
Aber danke :thumb: , ich liebe dieses Forum ;)


Alle Zeitangaben in WEZ +1. Es ist jetzt 23:51 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz