Autor Beitrag
That Guy
Hält's aus hier
Beiträge: 10



BeitragVerfasst: Sa 02.10.04 21:07 
Hallo, ich hoffe das ist im richtigen board ^^

Ich bin total der noob in delphi und turbo pascal und so n kack aber ich hab das nunmal in informatik, bin letzte jahr nur ganz knapp an nem defizit vorbei, damit dass dieses jahr nicht wieder wird hab ich mir das programm das momentan mucken macht mal mit nach hause genommen

aber ich bekomms einfach nicht hin.
wir müssen nen taschenrechner machen (der ist komplett fertig und funktionsfähig) und dazu einen rechner der die PQ formel beherrscht und genau dieser macht mucken.
wenn mir jemand helfen kann wäre es echt geil, ich poste einfach mal die komplette pq prozedure vielleicht seht ihr ja den fehler

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:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
unit UPq; 

interface 

uses 
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, 
StdCtrls; 

type 
TFmPQ = class(TForm) 
Label1: TLabel; 
Label2: TLabel; 
Eda: TEdit; 
Label3: TLabel; 
Edb: TEdit; 
Label4: TLabel; 
Edc: TEdit; 
Label5: TLabel; 
BtRech: TButton; 
BtClear: TButton; 
BtBack: TButton; 
Memo1: TMemo; 

procedure BtClearClick(Sender: TObject); 
procedure BtRechClick(Sender: TObject); 
procedure BtBackClick(Sender: TObject); 
procedure Memo1Change(Sender: TObject); 

private 
{ Private-Deklarationen } 
public 
{ Public-Deklarationen } 
end; 

var 
FmPQ: TFmPQ; 

implementation 
uses URechner1 ; 

{$R *.DFM} 


procedure TFmPQ.BtClearClick(Sender: TObject); 
Var a,b,c, ausgabe :Real; 
begin 
eda.text := ' '; 
edb.text := ' '; 
edc.text := ' '; 
Memo1.text := ' '; 
end; 

procedure TFmPQ.BtRechClick(Sender: TObject); 
Var a, b, c, x1, x2, disk:real; 

begin 
a := StrToFloat (EdA.Text); 
b := StrToFloat (EdB.Text); 
c := StrToFloat (EdC.text); 

disk := sqrt (b/(2*a))-c/a; 
If disk <0 then Memo1.lines [0] := 'Es gibt eine Lösung: '; 
If disk = 0 then 
begin 
Memo1.lines [0] := 'Es gibt eine Lösung'; 
x1:= -b*(2*a); 
Memo1.Lines [1] := x2 = 1+ FloatToStr (x1); 
end; 
If disk >0 then 
begin 
Memo1.Lines [0] :='Es gibt zwei Lösungen'; 
x1 := -b/2*a+sqrt (disk); 
Memo1.Lines[1] := 'x1= '+FloatToStr (x1); 
end; 
If wurzel >0 then 
begin 
memo1.lines [0] :='Es gibt zwei Lösungen: '; 
x1 := -zahl2/(2*zahl1)+sqrt (wurzel); 
memo1.lines [1] := 'x1= ' + FloatToStr (x1); 
x2 := -Zahl2 /(2*Zahl1) -sqrt (wurzel); 
Memo1.Lines[2] := 'x2= ' + FloatToStr (x2); 
end; 
end; 


procedure TFmPQ.BtBackClick(Sender: TObject); 
begin 
FmPQ.Visible:= False; 
FmRechner.visible := True; 
end; 


end.



Moderiert von user profile icontommie-lie: Delphi-Tags hinzugefügt
Alstar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 827



BeitragVerfasst: Sa 02.10.04 21:13 
Hi!

1. Was genau ist falsch / läuft nicht? Hab keine Lust den Quelltext durchzuarbeiten und auf Richtigkeit zu Überprüfen!

2. Bitte den Quelltext gescheit einrücken:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure XYZ;
begin
  Memo1.Text:='Hallo!';
  
  TueNichts;

  if True=True then
  begin
    TueWas;
  end;
end;


Alstar
That Guy Threadstarter
Hält's aus hier
Beiträge: 10



BeitragVerfasst: Sa 02.10.04 21:26 
ok sorry ^^

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:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
unit UPq;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TFmPQ = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Eda: TEdit;
    Label3: TLabel;
    Edb: TEdit;
    Label4: TLabel;
    Edc: TEdit;
    Label5: TLabel;
    BtRech: TButton;
    BtClear: TButton;
    BtBack: TButton;
    Memo1: TMemo;

    procedure BtClearClick(Sender: TObject);
    procedure BtRechClick(Sender: TObject);
    procedure BtBackClick(Sender: TObject);
    procedure Memo1Change(Sender: TObject);

  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  FmPQ: TFmPQ;

implementation
uses URechner1 ;

{$R *.DFM}


procedure TFmPQ.BtClearClick(Sender: TObject);
Var a,b,c, ausgabe :Real;
begin
 eda.text := ' ';
 edb.text := ' ';
 edc.text := ' ';
 Memo1.text := ' ';
end;

procedure TFmPQ.BtRechClick(Sender: TObject);
Var a, b, c, x1, x2, disk:real;

begin
 a := StrToFloat (EdA.Text);
 b := StrToFloat (EdB.Text);
 c := StrToFloat (EdC.text);

 disk := sqrt (b/(2*a))-c/a;
 If disk <0 then Memo1.lines [0] := 'Es gibt eine Lösung: ';
 If disk = 0 then
  begin
   Memo1.lines [0] := 'Es gibt eine Lösung';
   x1:= -b*(2*a);
   Memo1.Lines [1] := x2 = 1+ FloatToStr (x1);
  end;
 If disk >0 then
  begin
   Memo1.Lines [0] :='Es gibt zwei Lösungen';
   x1 :=  -b/2*a+sqrt (disk);
   Memo1.Lines[1] := 'x1= '+FloatToStr (x1);
  end;
 If wurzel >0 then
  begin
   memo1.lines [0] :='Es gibt zwei Lösungen: ';
   x1 := -zahl2/(2*zahl1)+sqrt (wurzel);
   memo1.lines [1] := 'x1= ' + FloatToStr (x1);
   x2 := -Zahl2 /(2*Zahl1) -sqrt (wurzel);
   Memo1.Lines[2] := 'x2= ' + FloatToStr (x2);
  end;
 end;
end;

procedure TFmPQ.BtBackClick(Sender: TObject);
begin
 FmPQ.Visible:= False;
 FmRechner.visible := True;
end;


end.


ist das so richtig eingerückt?

naja das problem ist aufjedenfall das da mehrer sachen wohl noch unstimmig sind, momentan bin ich bei der Fehlermeldung [Fehler] UPq.pas(67): Inkompatible Typen: 'String' und 'Integer' angekommen. Das ist die befehlszeile :
Memo1.Lines [1] := x2 = 1+ FloatToStr (x1);

aber wie gesagt, da sind wohl noch einige fehler mehr drin ..
danke schonmal
Alstar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 827



BeitragVerfasst: Sa 02.10.04 22:13 
Ich schätze, dass Du in diesem Fall vergessen hast das "x1=" in Hochkommatar zu setzen und die "+1" falsch gesetzt hast:

ausblenden Delphi-Quelltext
1:
Memo1.Lines [1] := 'x2 =' + FloatToStr (x1+1);					


Alstar
That Guy Threadstarter
Hält's aus hier
Beiträge: 10



BeitragVerfasst: Sa 02.10.04 22:44 
jo danke,
nun der nächste fehler den ich nicht alleine bewältigt bekomm

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:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
unit UPq;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TFmPQ = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Eda: TEdit;
    Label3: TLabel;
    Edb: TEdit;
    Label4: TLabel;
    Edc: TEdit;
    Label5: TLabel;
    BtRech: TButton;
    BtClear: TButton;
    BtBack: TButton;
    Memo1: TMemo;

    procedure BtClearClick(Sender: TObject);
    procedure BtRechClick(Sender: TObject);
    procedure BtBackClick(Sender: TObject);
    procedure Memo1Change(Sender: TObject);

  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  FmPQ: TFmPQ;

implementation
uses URechner1 ;

{$R *.DFM}


procedure TFmPQ.BtClearClick(Sender: TObject);
Var a,b,c, ausgabe :Real;
begin
eda.text := ' ';
edb.text := ' ';
edc.text := ' ';
Memo1.text := ' ';
end;

procedure TFmPQ.BtRechClick(Sender: TObject);
Var a, b, c, x1, x2,zahl1, zahl2, wurzel, disk:real;

begin
a := StrToFloat (EdA.Text);
b := StrToFloat (EdB.Text);
c := StrToFloat (EdC.text);

disk := sqrt (b/(2*a))-c/a;
If disk <0 then Memo1.lines [0] := 'Es gibt eine Lösung: ';
If disk = 0 then
begin
Memo1.lines [0] := 'Es gibt eine Lösung';
x1:= -b*(2*a);
Memo1.Lines [1] := 'x2 =' + FloatToStr (x1+1);
end;
If disk >0 then
begin
Memo1.Lines [0] :='Es gibt zwei Lösungen';
x1 :=  -b/2*a+sqrt (disk);
Memo1.Lines[1] := 'x1= '+FloatToStr (x1);
end;
If wurzel >0 then
begin
memo1.lines [0] :='Es gibt zwei Lösungen: ';
x1 := -zahl2/(2*zahl1)+sqrt (wurzel);
memo1.lines [1] := 'x1= ' + FloatToStr (x1);
x2 := -Zahl2 /(2*Zahl1) -sqrt (wurzel);
Memo1.Lines[2] := 'x2= ' + FloatToStr (x2);
end;
end;


procedure TFmPQ.BtBackClick(Sender: TObject);
begin
FmPQ.Visible:= False;
FmRechner.visible := True;
end;


end.


[Fehler] UPq.pas(27): Ungenügende Forward- oder External-Deklaration: 'TFmPQ.Memo1Change'
Alstar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 827



BeitragVerfasst: Sa 02.10.04 22:46 
Hi!

Am besten du authest mich mal bei ICQ, dann müssen wir nicht den Quelltext im Forum Schritt für Schritt durchgehen :-)

Alstar
GSE
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 740

Win 2k, Win XP Pro
D5 Prof, D6 Ent, D2k5 PE
BeitragVerfasst: Sa 02.10.04 23:24 
Zitat:
Ich bin total der noob in delphi und turbo pascal und so n kack
und noch ein beispiel wie man sich schnell freunde in einem programmier-forum macht :wink:

mfg
GSE

_________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs
and the universe trying to produce bigger and better idiots. So far, the universe is winning. (Richard Cook)
Tilo
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 1098
Erhaltene Danke: 13

Win7 geg. WInXP oder sogar Win98
Rad2007
BeitragVerfasst: So 03.10.04 08:03 
@That Guy setzt doch bitte mal
ausblenden Delphi-Quelltext
1:
//					

vor die entsprechende Zeile.
That Guy Threadstarter
Hält's aus hier
Beiträge: 10



BeitragVerfasst: So 03.10.04 10:14 
GSE hat folgendes geschrieben:
Zitat:
Ich bin total der noob in delphi und turbo pascal und so n kack
und noch ein beispiel wie man sich schnell freunde in einem programmier-forum macht :wink:

mfg
GSE


sorry, das ist echt nicht so gemeint, naja irgendwie doch weil mich das thema seit der 11 plagt und ich voll kein plan davon hab aber ich hab echt hochachtung vor den leuten die das alles können

Tilo hat folgendes geschrieben:
@That Guy setzt doch bitte mal
ausblenden Delphi-Quelltext
1:
//					

vor die entsprechende Zeile.


wie?
sorry wenn ich nicht alles richtig mache, bin ja neu hier, also soll bei jedem zeilen anfang ein // stehen ?

@Alstar

kk^^
Tilo
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 1098
Erhaltene Danke: 13

Win7 geg. WInXP oder sogar Win98
Rad2007
BeitragVerfasst: So 03.10.04 13:07 
[quote="That Guy"]
GSE hat folgendes geschrieben:

wie?
sorry wenn ich nicht alles richtig mache, bin ja neu hier, also soll bei jedem zeilen anfang ein // stehen ?


Ne, sondern nur vor zeile 27 in deinem Code. Die Fehlermeldung kommt, weil Du keinen Code für die Procedure Memo1Change(Sender: TObject) hast.
Entweder so nihmst die Zeile aus den Code raus(löschen oder // davor) oder Du schreibs etwas Code zu der Procedure.
GSE
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 740

Win 2k, Win XP Pro
D5 Prof, D6 Ent, D2k5 PE
BeitragVerfasst: So 03.10.04 13:16 
Zitat:
GSE hat folgendes geschrieben
jetzt war ichs wieder :cry:

mfg
GSE

_________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs
and the universe trying to produce bigger and better idiots. So far, the universe is winning. (Richard Cook)
Alstar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 827



BeitragVerfasst: So 03.10.04 13:22 
Ja! DU bist Schuld! :twisted:

Wer sonst? :nixweiss:

Alstar
Tilo
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 1098
Erhaltene Danke: 13

Win7 geg. WInXP oder sogar Win98
Rad2007
BeitragVerfasst: So 03.10.04 15:05 
:flehan: :flehan: :flehan: :flehan: :flehan: :flehan: :flehan: :flehan:
Muss den Umgang mit den Tags üben.
:flehan: :flehan: :flehan: :flehan: :flehan: :flehan: :flehan: :flehan:
That Guy Threadstarter
Hält's aus hier
Beiträge: 10



BeitragVerfasst: Mo 04.10.04 20:24 
danke an alle die mir geholfen ahben.
besonders an Alstar, der sich das programm mal komplett vorgenommen hat

bei weiteren fragen bezüglich anderen aufgaben aus der schule werd ich mich hier wieder melden
^^