Autor Beitrag
!TNT!
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 17

WIN XP
Delphi 6
BeitragVerfasst: Mi 08.03.06 18:06 
hey jo, wie gehts euch?
nur ne simple frage:wie bau ich ne konstante ein?!!
bitte schnell um antwort!
cya
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Mi 08.03.06 18:07 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
//ich schreibs immer über uses
const
message='Huhu!';

showmessage(message);

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Kroni
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 720

Win 98, Win ME, Win2k, Win XP
D3 Pro
BeitragVerfasst: Mi 08.03.06 18:08 
INdem du an der betreffenden Stelle schreibst
ausblenden Delphi-Quelltext
1:
const a=25;					

oder ähnliches;)
//Mist, da war ich wohl zwei sekundne zu spät---
Naja@Marco: Wenn du es über Uses scheribst, wäre die Konstante Public, aber ich vertrete die Philosophie: So wenig wie möglich Public, nur dann, wenn es unbedingt sein muss!
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Mi 08.03.06 18:10 
Wo dann hin?

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Christian V.
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 311

Win Xp Prof
Turbo Delphi 2005
BeitragVerfasst: Mi 08.03.06 18:20 
Am besten in die Prozedur in der du sie brauchst.
einfach unter

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TForm1.button1Click(Sender: TObject);
const
a=25;
begin

end;

_________________
Hardware runs the world, software controls the hardware, code generates software - Have You already coded today?
!TNT! Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 17

WIN XP
Delphi 6
BeitragVerfasst: Mi 08.03.06 18:55 
danke erstma
aber ich habe eine lineare funktion der form y=mx+n und der user soll m und n eingeben können und die fertige funktion soll dann erscheinen.wobei x die konstante darstellen soll.

??

:)
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Mi 08.03.06 18:59 
Mal die Suche benutzen.

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
!TNT! Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 17

WIN XP
Delphi 6
BeitragVerfasst: Mi 08.03.06 19:06 
hab gesucht,aber das hilft mir nicht.
da das prog eine funktion ausgeben soll und ich nicht weiß wie man die konstante x definiert/declariert.
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Mi 08.03.06 19:09 
Was soll X für einen Wert annehmen?
Ich glaube, du verwechselst da was.
Warum soll X eine Konstante werden?

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
!TNT! Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 17

WIN XP
Delphi 6
BeitragVerfasst: Mi 08.03.06 19:12 
weil ich der user nur n und m eingeben soll und am ende des programms eine funktion z.b. y=5x+4 erscheinen soll.und ich weiß nicht wie ich dieses "x" darstellen soll bzw. definieren soll.es soll also keinen werten annehmen.
quasi x=x





ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
var Anstieg,absolutesGlied,Nullstelle,Funktion:real;
var x:char;

begin


 Anstieg:=StrToFloat(Edit1_m.text);
 absolutesGlied:=StrToFloat(Edit2_n.Text);


 Nullstelle:=-absolutesGlied/Anstieg;
 Funktion:=Anstieg*x+absolutesGlied;



 Edit4_NST.Text:=FloatToStr(Nullstelle);
 Edit3_Fkt.Text:=FloatToStr(Funktion);
 end;


Moderiert von user profile iconChristian S.: Delphi-Tags hinzugefügt
zivi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 17



BeitragVerfasst: Mi 08.03.06 19:16 
schreib doch das 'x', das du ja als konstante angeben wilst auf's formular und nicht in ein edit-fenster
!TNT! Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 17

WIN XP
Delphi 6
BeitragVerfasst: Mi 08.03.06 19:19 
habe ich auch schon überlegt,aber das sieht optisch nicht dem entsprechend aus.
gibt es keine andere variante?
unforgiven
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 46

Win XP
Delphi 2005 Prof.
BeitragVerfasst: Mi 08.03.06 23:02 
lass des doch in ner for schleife meinetwegen für x von -10 bis 10 laufen und dann zeichnen lassen...bzw mit ner while schleife geht das schöner

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
x:=-10;
while < 10.00 do
begin
<zeichne punkt>;

x:=x+0,01
end;

{jetzt fängt er bei x=-10 an und rechnet immer + 0,01 und macht dann wieder nen punkt und immer so weiter...am ende kommt dann ne funktion raus

_________________
Ein Programm ist nur so gut, wie der Programmierer.
!TNT! Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 17

WIN XP
Delphi 6
BeitragVerfasst: Do 09.03.06 13:46 
schönen Dank Stefan!
soll dein Tip gut sein, um eine Funktion zu zeichnen? Dies ist nicht mein Ziel!
das Ziel besteht darin in dem Editfenster eine Funktion der Form y=mx+n ausgegeben zu bekommen! m und n sollen bereits eingegeben sein und diese Funktion soll nur noch verfollständigt werden durch die Konstante x.

bitte weiterhin um Vorschläge!
Danke !TNT!
freak4fun
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 604
Erhaltene Danke: 4

Win 7 Pro
VS 2013 Express, Delphi, C#, PHP, Java
BeitragVerfasst: Do 09.03.06 13:58 
Sowas?
ausblenden Delphi-Quelltext
1:
Edit1.Text := Format('y=%sx%s', [Edit2.Text, Edit3.Text]);					


Wobei Edi2 = m und Edit3 = n.

ausblenden Delphi-Quelltext
1:
2:
3:
m := Edit2.Text;
n := Edit3.Text;
Edit1.Text := Format('y=%sx%s', [m, n]);



MfG
freak
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5285
Erhaltene Danke: 29

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Do 09.03.06 14:06 
und niemals message als variable oder konstante benutzen ! das oben ist ein schleeechtes beispiel ^^
!TNT! Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 17

WIN XP
Delphi 6
BeitragVerfasst: Do 09.03.06 14:19 
und wäre es jetz noch möglich, das dann in dem editfenster das'+' ausgegeben wird?

Edit3_Fkt.Text:= Format('y=%sx%s', [Edit1_m.Text, Edit2_n.Text]);

so, dass man zwischen dem sx und dem s noch ein + reinbekommt? auf alle fälle seid ihr spitze jungs, vielen dank!
!TNT! Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 17

WIN XP
Delphi 6
BeitragVerfasst: Do 09.03.06 14:31 
sorry, ich war grad nich so blickig, habs jetz!
Miri
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 657


Delphi 3 Prof., Delphi 2005 PE
BeitragVerfasst: Do 09.03.06 14:33 
Wie wärs einfach mit

ausblenden Delphi-Quelltext
1:
edit1.text := 'y = ' + edit2.text + ' x + ' + edit3.text;					


dabei steht in edit2 dein m und in edit 3 dein b...
!TNT! Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 17

WIN XP
Delphi 6
BeitragVerfasst: Do 09.03.06 14:35 
und die zweite sache ist, ich hab den hinweis gegeben, wenn man m=0 setzt, dass man dann eine gerade der Gleichung y=n bekommt! mein prob is jetz, dass ich m nicht 0 setzen darf, denn sonst wäre die glechung x=-n/m nicht mehr definiert! ich habs versucht mit if...then, aber das scheint nicht zu funktionieren.