A
A
Alexander Nikolaevich2016-06-29 11:34:08
Pascal
Alexander Nikolaevich, 2016-06-29 11:34:08

How to set the length of a two dimensional dynamic array array in pascal?

write code in pascal abs

var a,i,t,n:integer;

mas:array of array of real;
begin 
writeln('Vvedite kolichestvo slov');
readln(n);
SetLength(mas,5,5);
for i:=0 to n do 
begin 
writeln('Vvedite slovo');
read(t);
b[1,i]:=t;
end;
for i:=0 to n do 
begin 
writeln(b[1,i]);


end;
end.

in the line with the length specification, it gives out expected two parameters in the examples on the Internet there are three, everything seems to be correct, but I get an error

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Nikolaevich, 2016-06-29
@User258

found a solution

uses Arrays;


var a,i,t,n:integer;
mas: array [,] of real;


begin 
writeln('Vvedite kolichestvo slov');
readln(n);
mas := new real[1,n+1];
for i:=0 to n-1 do 
begin 
writeln('Vvedite slovo');
read(t);
mas[0,i]:=t;
end;
for i:=0 to n do 
begin 
writeln(mas[0,i]);


end;
end.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question