Einzelnen Beitrag anzeigen

diavy

Registriert seit: 11. Apr 2012
54 Beiträge
 
#8

AW: Problem mit einem "leeren" String

  Alt 4. Mai 2012, 20:53
Also ich hab's mal mit der for .. in-Schleife probiert und das hat nicht hingehauen.

Code:
program ex53;
{$APPTYPE CONSOLE}

uses
SysUtils;

var
a:string;

function countthenumbers(a:string):integer;
var
x:integer;
c:char;
begin
x:=0;
for c in a do
if c in ['0','1','2','3','4','5','6','7','8','9'] then x:=x+1;
result:=x;
end;

begin
{ TODO -oUser -cConsole Main : Insert code here }
writeln('Please enter a string:');
readln(a);
writeln('The amount of numbers in your string is:',countthenumbers(a));
readln;
end.
--> [Error] ex53.dpr(16): Operator not applicable to this operand type
--> [Error] ex53.dpr(17): Incompatible types: 'Boolean' and 'procedure, untyped pointer or untyped parameter'
--> [Error] ex53.dpr(19): Expression expected but 'END' found
  Mit Zitat antworten Zitat