Autor Beitrag
ConditionZero
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 190

Win XP
Delphi 7 PE, C++ (Dev-C++), HTML+PHP (Dreamweaver MX), JavaScript(MS FrontPage)
BeitragVerfasst: Sa 21.04.07 15:31 
Moin,

Ich will alle Werte eines dynamischen Arrays zusammenzählen, weiß aber nicht genau wie das funktioniert.
Mein Ansatz:
ausblenden Delphi-Quelltext
1:
for Low(Werte) to High(Werte) do QS:= Werte;					


aber was nach dem do hinkommt weiß ich nicht. Dazu bringt er die Fehlermeldung das die FOR-Schleifenvariable eine einfache lokale sein muss. << Die ist aber lokal deklariert.

lg
marc


Moderiert von user profile iconGausi: Topic aus VCL (Visual Component Library) verschoben am Sa 21.04.2007 um 16:36
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: Sa 21.04.07 15:35 
ausblenden Delphi-Quelltext
1:
2:
3:
Summe := 0;
for i := Low(Werte) to High(Werte) do
  Summe := Summe + Werte[i];

_________________
We are, we were and will not be.
ConditionZero Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 190

Win XP
Delphi 7 PE, C++ (Dev-C++), HTML+PHP (Dreamweaver MX), JavaScript(MS FrontPage)
BeitragVerfasst: Sa 21.04.07 15:43 
Danke hat geholfen :)
ConditionZero Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 190

Win XP
Delphi 7 PE, C++ (Dev-C++), HTML+PHP (Dreamweaver MX), JavaScript(MS FrontPage)
BeitragVerfasst: Sa 21.04.07 15:52 
Nochmal ne Frage: :oops:


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
x:= Edit1.GetTextLen;                // x die Länge des Edit1 zuweißen.
i:= 1;                               // i den Anfangswert geben.
while i <= x do                      // Zahlen in Array übertragen.
  begin
  Werte[i]:= StrToInt(Edit1.Text[i]);
  i:= i+1;
  end;


In der Zeile   Werte[i]:= StrToInt(Edit1.Text[i]); gibt es einen Laufzeitfehler: Zugriffsverletzung.
Woran könnte das liegen?

lg
marc
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Sa 21.04.07 15:54 
Hallo!

Bitte erstelle für neue Fragen auch einen neuen Thread. Danke!

Grüße
Christian

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
Dieses Thema ist gesperrt, Du kannst keine Beiträge editieren oder beantworten.

Das Thema wurde von einem Team-Mitglied geschlossen. Wenn du mit der Schließung des Themas nicht einverstanden bist, kontaktiere bitte das Team.