Answer the question
In order to leave comments, you need to log in
How to pass array values to check in val procedure?
Help, please, something does not fit (
Procedure Val(S: String; A: TMyArray; var Error: Integer);
Var I: Integer;
Begin
Val(S, A[I,1], Error);
if Error <> 0 then
writeln('Incorrect input. Please try again.');
End;
//Procedure for filling an array with integer or fractional values
Procedure MatrixInput(var A: TMyArray);
Var I, Error: Integer;
Input: String;
Begin
writeln('Filling an array with numbers:');
for I:=1 to M do
Begin
readln(input);
Val(Input, A[I,1], Error);
writeln('Pixels[', I:2, '] = (', A[I,1]:3:1, ', ', A[I,2]:3:1, ')');
End;
Answer the question
In order to leave comments, you need to log in
If you want to pass an array value, then accept it, not an array.
Procedure Val(S: String; var A: real; var Error: Integer);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question