| Autor |
Beitrag |
D2505
      
Beiträge: 62
Erhaltene Danke: 18
Delphi (7 PE + Lazarus ) ;Java ( Eclipse),
|
Verfasst: Di 14.12.10 18:04
hallo ich wollte ein einfachen würfel programmieren
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: 34:
| unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;
type TForm1 = class(TForm) Label1: TLabel; Button1: TButton; procedure Button1Click(Sender: TObject); private public end;
var Form1: TForm1; Zahl1: implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject); begin randomize; Zahl1 := random (100); Label1.Caption := FloatToStr(Zahl1); end;
end. |
aber er sagt mir beim ausführen typ erwartet aber implentation gefunden woran liegt das war ja imm automatisch erstellten quellcode drin
mfg Moderiert von Narses: Topic aus Sonstiges (Delphi) verschoben am Di 14.12.2010 um 17:05
|
|
Narses
      

Beiträge: 10185
Erhaltene Danke: 1261
W11x64
TP3 .. D7pro .. D10.2CE
|
Verfasst: Di 14.12.10 18:07
Moin!
Hast du evtl. hier etwas "vergessen":
D2505 hat folgendes geschrieben : | Delphi-Quelltext 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11:
| public end;
var Form1: TForm1; Zahl1: Integer; implementation
{$R *.dfm} | |
cu
Narses
_________________ There are 10 types of people - those who understand binary and those who don´t.
Für diesen Beitrag haben gedankt: D2505
|
|
jaenicke
      
Beiträge: 19346
Erhaltene Danke: 1754
W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
|
Verfasst: Di 14.12.10 18:16
Naja, eigentlich ist eher das "Zahl1:" dort zu viel. Globale Variablen sollte man der Übersichtlichkeit wegen nach Möglichkeit vermeiden.
Deshalb: Delphi-Quelltext 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34:
| { ... } TForm1 = class(TForm) Label1: TLabel; Button1: TButton; procedure Button1Click(Sender: TObject); private public end;
var Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject); var Zahl1: Integer; begin randomize; Zahl1 := random (100); Label1.Caption := FloatToStr(Zahl1); end; | 
|
|
Martok
      
Beiträge: 3661
Erhaltene Danke: 604
Win 8.1, Win 10 x64
Pascal: Lazarus Snapshot, Delphi 7,2007; PHP, JS: WebStorm
|
Verfasst: Di 14.12.10 18:21
_________________ "The phoenix's price isn't inevitable. It's not part of some deep balance built into the universe. It's just the parts of the game where you haven't figured out yet how to cheat."
Für diesen Beitrag haben gedankt: D2505
|
|
jaenicke
      
Beiträge: 19346
Erhaltene Danke: 1754
W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
|
Verfasst: Di 14.12.10 18:24
Herauskommen tut aber das selbe.
Aber du hast ja Recht. 
|
|
D2505 
      
Beiträge: 62
Erhaltene Danke: 18
Delphi (7 PE + Lazarus ) ;Java ( Eclipse),
|
Verfasst: Mi 15.12.10 17:54
danke jetzt tut es mein würfel programm
|
|
F34r0fTh3D4rk
      
Beiträge: 5284
Erhaltene Danke: 27
Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
|
Verfasst: Mi 15.12.10 18:09
Ich sehe irgendwie gerade nicht, was das Programm mit einem Würfel zu tun hat.
Wenn damit ein Spielwürfel gemeint ist, so ist das nicht ganz richtig, da ein W100 aufgrund seiner Form nicht ganz ideal ist. 
|
|
D2505 
      
Beiträge: 62
Erhaltene Danke: 18
Delphi (7 PE + Lazarus ) ;Java ( Eclipse),
|
Verfasst: Sa 18.12.10 19:33
ja das habe ich schon angepasst
falst du random(100) meinst
|
|