Hallo,
ich habe ein Buch-tutorial für delphi…
nach den ersten 80 seiten gehts nicht mehr weiter, da ein dort geschriebener sc nicht funkt (höstwahrscheinlich)
so ich dachte ich poste den mal, vllt weiß einer von euch dazu etwas:
unit rechner1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
procedure Label3Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
var Zahl1, Zahl2, Ergebnis: Integer;
implementation
{$R *.DFM}
procedure TForm1.Label3Click(Sender: TObject);
begin
randomize;
Zahl1 := random (100);
Zahl2 := random (100);
Label1.Caption := IntToStr(Zahl1);
Label2.Caption := IntToStr(Zahl2);
Label3.Caption := 'Wähle die Rechenart!';
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Ergebnis := Zahl1 + Zahl2;
Label3.Caption :=
'Ergebnis der Addition: '+ IntToStr(Ergebnis)
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Ergebnis := Zahl1 - Zahl2;
Label3.Caption := 'Ergebnis der Subtraktion: '+ IntToStr(Ergebnis)
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
Ergebnis := Zahl1 * Zahl2;
Label3.Caption := 'Ergebnis der Multiplikation: '+ IntToStr(Ergebnis)
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
Ergebnis := Zahl1 div Zahl2;
Label3.Caption := 'Ergebnis der ADivision: '+ IntToStr(Ergebnis)
end;
end.
sagt das jemandem was?
mfg
Moderator-Edit - Aktion: Code-Tags hinzugefügt (Artemis)