program Assignment6(input, output);
Var
file1 : text;
c : char;
error : boolean;
num1 : integer;
function convert(c: char): integer;
begin
convert := ord(c) - ord('0');
end; { convert }
function find_digits(var c : char): integer;
Var
num : integer;
begin
num := 0;
while (ord(c) >= ord('0')) and (ord(c) <= ord('9')) do
begin
num := num * 10 + (ord(c) - ord('0'));
read(file1, c);
end;
end; { find_digits }
procedure ignorespaces;
begin
while c = ' ' do
read(file1, c);
end; { ignore_spaces }
BEGIN
assign(file1, 'input.txt');
reset(file1);
read(file1, c);
error := false;
ignorespaces;
If ((ord(c) >= ord('0')) and (ord(c) <= ord('9'))) then
begin
find_digits;
num1 := find_digits(c);
end;
end.
ok it makes more sense having it an function. Did I write the function find_digits right? Is the num suppose to be declared like that? Would I need to change anything in the main program now? Getting these errors c6.p: In function `Find_digits':
c6.p:25: warning: return value of function not assigned
c6.p: In main program:
c6.p:45: too few arguments to function `Find_digits'
c6.p:45: warning: function call as a statement - value is ignored
EDIT: Ok i got most of the errors down, last one is giving me a hard time.
warning: return value of function not assigned