Autor Beitrag
Jenny
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35



BeitragVerfasst: Sa 05.04.03 18:40 
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
function anz_b(s:string):Integer;
var ch:char;
    i, anz:integer;
begin
  anz:=0;
  for i=1 to length(s) do
  begin
    ch:=UpCase(s[i]);
    if ch in ['A'..'Z']
    then inc(anz);
  end;
  anz_b:=anz;
end;


procedure TForm1.b_anzahlClick(Sender: TObject);
begin
 l_anz.caption:=IntToStr(anz_b);
end;



ich bins mal wieder :mrgreen: und stehe kurz vor der klausur :roll:
delphi meckert folgendes:
-FOR-Schleifenvariable muss eine einfache lokale Variable sein
-Inkompatible Typen: 'Boolean' und 'Integer'
-Ausdruck erwartet aber 'BEGIN' gefunden

:(


und das tollste is die obere function haben wir im unterricht so aufgeschrieben... toll gemacht herr lehrer :evil:
Alibi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 458

Win2K SP3
Delphi 6 Ent
BeitragVerfasst: Sa 05.04.03 18:44 
for i=1 to length(s) do

muss heißen

for i:=1 to length(s) do
UGrohne
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Veteran
Beiträge: 5502
Erhaltene Danke: 220

Windows 8 , Server 2012
D7 Pro, VS.NET 2012 (C#)
BeitragVerfasst: Sa 05.04.03 18:45 
Mach um ch in ['A'..'Z'] mal ne Klammer, dann gehts wahrscheinlich.

Nur so ne Idee, nen anderen Fehler find ich grad net
Jenny Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35



BeitragVerfasst: Sa 05.04.03 18:47 
Alibi hat folgendes geschrieben:
for i=1 to length(s) do

muss heißen

for i:=1 to length(s) do


vielen dank das war der fehler :)

aber du meckert er bei der procedure:
- nicht genügend wirkliche parameter

:(
Alibi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 458

Win2K SP3
Delphi 6 Ent
BeitragVerfasst: Sa 05.04.03 18:50 
Ah, meld dich mal über icq, da fehlt ja noch einiges. :) Geht schneller.