Autor Beitrag
lql
Hält's aus hier
Beiträge: 13



BeitragVerfasst: Do 19.01.06 16:39 
Hallo !

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
  FOR tygodnie := 0 to 5 do
    begin
        podatek := sprzedaz * 0.95;
        podatek2 := sprzedaz - podatek;
        p2.caption:=floattostrf(podatek,ffFixed,10,2);
        p3.caption:=floattostrf(podatek2,ffFixed,10,2);
    end;
  FOR tygodnie := 6 to 15 do
    begin
        podatek := sprzedaz * 0.50;
        podatek2 := sprzedaz - podatek;
        p2.caption:=floattostrf(podatek,ffFixed,10,2);
        p3.caption:=floattostrf(podatek2,ffFixed,10,2);
    end;
  FOR tygodnie := 16 to 9999 do
    begin
        podatek := sprzedaz * 0.20;
        podatek2 := sprzedaz - podatek;
        p2.caption:=floattostrf(podatek,ffFixed,10,2);
        p3.caption:=floattostrf(podatek2,ffFixed,10,2);
    end;


Wieso wird bei diesen 3 Schleifen nur die letzte von Delphi beachtet und wie kann ich dieses Problem umgehen ?
Martin1966
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1068

Win 2000, Win XP
Delphi 7, Delphi 2005
BeitragVerfasst: Do 19.01.06 16:49 
user profile iconlql hat folgendes geschrieben:
Wieso wird bei diesen 3 Schleifen nur die letzte von Delphi beachtet

Was meinst du mit beachtet? Werden die beiden ersten Schleifen nicht mal kompiliert, oder stimmt das Ergebnis nicht? Hast du schon mal debuggt?

lg martin

ps: warum hast du das in das "VCL (Visual Component Library)" forum gepostet?

_________________
Ein Nutzer der Ecke ;-)
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Do 19.01.06 16:52 
Die Ergebnisse der ersten beiden Schleifen werden zwangsläufig von der letzten "überschrieben".
Allesquarks
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 510

Win XP Prof
Delphi 7 E
BeitragVerfasst: Do 19.01.06 17:03 
Wenn du unbedingt sehen willst, wie das durchlaufen wird kannst du unter den Projektoptionen auf der Karteikarte Compiler die Optimierungen abschalten. Dann wird das auf jeden Fall mitcompiliert.
lql Threadstarter
Hält's aus hier
Beiträge: 13



BeitragVerfasst: Do 19.01.06 17:16 
Zitat:
Die Ergebnisse der ersten beiden Schleifen werden zwangsläufig von der letzten "überschrieben".


Und wie kann ich das umgehen ? :P
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Do 19.01.06 17:21 
Das kann man verhindern, indem man die dritte Schleife weglässt. Erklär mal, was du mit diesen drei Schleifen bezwecken willst. Könnte sein, dass du einen Denkfehler bei der Sache machst.

_________________
We are, we were and will not be.
lql Threadstarter
Hält's aus hier
Beiträge: 13



BeitragVerfasst: Do 19.01.06 18:30 
Also ich hab ein EDIT-Feld. Wenn ich in dieses EDIT-Feld eine Zahl zwischen 0 und 5 schreibe, dann soll die erste FOR TO DO-Schleife "aktiviert" werden. Wenn ich eine Zahl zwischen 6 und 15 schreibe die zweite und bei allen Zahlen von 16 bis 9999 die dritte Schleife.
mikhal
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 109

Windows 10 Professional 64-Bit
VS 215 CE, Delphi 10.1 Berlin Professional
BeitragVerfasst: Do 19.01.06 18:41 
Die For-Schleife ist eine Zählschleife! Du meinst doch sicher folgendes:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
if (tygodnie >= 0) and (tygodnie <= 5) then
   begin   
        podatek := sprzedaz * 0.95;   
        podatek2 := sprzedaz - podatek;   
        p2.caption:=floattostrf(podatek,ffFixed,10,2);   
        p3.caption:=floattostrf(podatek2,ffFixed,10,2);   
    end
else if (tygodnie >= 6) and (tygodnie <= 15) then
    begin   
        podatek := sprzedaz * 0.50;   
        podatek2 := sprzedaz - podatek;   
        p2.caption:=floattostrf(podatek,ffFixed,10,2);   
        p3.caption:=floattostrf(podatek2,ffFixed,10,2);   
    end
else....


Grüße
Mikhal

_________________
Computer erleichtern die Arbeit...
...und die Erde ist eine Scheibe!