![]() |
Re: Compile problem
Und dann kann ich Dir schonmal gleich dazu sagen, dass Deine Geteilt-Funktion nicht klappen wird. Das Ergebnis einer Division ist nämlich in der Regel eine Gleitkommazahl (Float) und keine Ganzzahl (Integer).
|
Re: Compile problem
Zitat:
kann |
Re: Compile problem
nagut...mit /setz ich mich nochma auseinander;) aber egal
Delphi-Quellcode:
das probem is bei Lable4.cpation
unit Unit1;
interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Edit1: TEdit; Edit2: TEdit; Label1: TLabel; Label2: TLabel; Button1: TButton; Button2: TButton; Button3: TButton; Button4: TButton; Label3: TLabel; Label4: TLabel; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button3Click(Sender: TObject); procedure Button4Click(Sender: TObject); private { Private-Deklarationen } public { Public-Deklarationen } end; var Form1: TForm1; implementation {$R *.DFM} procedure TForm1.Button1Click(Sender: TObject); var zahl1, zahl2, ergebnis: Integer; begin zahl1 := StrToInt(Edit1.Text); zahl2 := StrToInt(Edit2.text); ergebnis := zahl1 + zahl2 Lable4.Caption := IntToStr(ergebnis) end; procedure TForm1.Button2Click(Sender: TObject); var zahl1, zahl2, ergebnis: Integer; begin zahl1 := StrToInt(Edit1.Text); zahl2 := StrToInt(Edit2.text); ergebnis := zahl1 - zahl2 Lable4.Caption := IntToStr(ergebnis) end; procedure TForm1.Button3Click(Sender: TObject); var zahl1, zahl2, ergebnis: Integer; begin zahl1 := StrToInt(Edit1.Text); zahl2 := StrToInt(Edit2.text); ergebnis := zahl1 * zahl2 Lable4.Caption := IntToStr(ergebnis) end; procedure TForm1.Button4Click(Sender: TObject); var zahl1, zahl2, ergebnis: Integer; begin zahl1 := StrToInt(Edit1.Text); zahl2 := StrToInt(Edit2.text); ergebnis := zahl1 DIV zahl2 Lable4.Caption := IntToStr(ergebnis) end; end. |
Re: Compile problem
Oder
Delphi-Quellcode:
procedure TForm1.Button4Click(Sender: TObject);
var zahl1, zahl2, ergebnis: Double; begin zahl1 := StrToInt(Edit1.Text); zahl2 := StrToInt(Edit2.text); ergebnis := zahl1 DIV zahl2 Lable4.Caption := FloatToStr(ergebnis) end; |
Re: Compile problem
so...hab geändert...aber jetz is immernoch das Lable4.Caption problem wenn ich das debuggen will
Delphi-Quellcode:
unit Unit1;
interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Edit1: TEdit; Edit2: TEdit; Label1: TLabel; Label2: TLabel; Button1: TButton; Button2: TButton; Button3: TButton; Button4: TButton; Label3: TLabel; Label4: TLabel; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button3Click(Sender: TObject); procedure Button4Click(Sender: TObject); private { Private-Deklarationen } public { Public-Deklarationen } end; var Form1: TForm1; implementation {$R *.DFM} procedure TForm1.Button1Click(Sender: TObject); var zahl1, zahl2, ergebnis: Integer; begin zahl1 := StrToInt(Edit1.Text); zahl2 := StrToInt(Edit2.text); ergebnis := zahl1 + zahl2 Lable4.Caption := IntToStr(ergebnis) end; procedure TForm1.Button2Click(Sender: TObject); var zahl1, zahl2, ergebnis: Integer; begin zahl1 := StrToInt(Edit1.Text); zahl2 := StrToInt(Edit2.text); ergebnis := zahl1 - zahl2 Lable4.Caption := IntToStr(ergebnis) end; procedure TForm1.Button3Click(Sender: TObject); var zahl1, zahl2, ergebnis: Integer; begin zahl1 := StrToInt(Edit1.Text); zahl2 := StrToInt(Edit2.text); ergebnis := zahl1 * zahl2 Lable4.Caption := IntToStr(ergebnis) end; procedure TForm1.Button4Click(Sender: TObject); var zahl1, zahl2, ergebnis: Double; begin zahl1 := StrToInt(Edit1.Text); zahl2 := StrToInt(Edit2.text); ergebnis := zahl1 DIV zahl2 Lable4.Caption := FloatToStr(ergebnis) end; end. |
Re: Compile problem
Welcher Fehler wird angezeigt?
|
Re: Compile problem
naja...wenn ich debuggen will dann makiert er diese zeile und setzt meinen courser zwischen 4 und .
Delphi-Quellcode:
Label4.Caption := IntToStr(ergebnis)
|
Re: Compile problem
Zitat:
Grüße, Max Edit: Oder so, mkinzler ;) |
Re: Compile problem
Es fehlt jeweils der Strichpunkt bei
Delphi-Quellcode:
also
ergebnis := zahl1 + zahl2
Delphi-Quellcode:
ergebnis := zahl1 + zahl2;
|
Re: Compile problem
Delphi-Quellcode:
da kommt dann:[Fehler] Unit1.pas(76): Operator ist auf diesen Operandentyp nicht anwendbar
ergebnis := zahl1 DIV zahl2;
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:49 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-2025 by Thomas Breitkreuz