我必须在 FreePascal 中制作随机二维数组(4x4)。每个元素必须介于 0 到 100 之间。
例如:
12 99 1 85
43 75 5 11
0 100 77 31
64 15 9 74
我试过了,但它不起作用:
var
row:array[1..4] of string = (random(100));
column:array[1..4] of string = (random(100));
matrix:array[1..4,1..4] of string;
x:integer;
y:integer;
begin
for x := 1 to 4 do
for y := 1 to 4 do
matrix[x,y] := row[x] + column[y];
for x := 1 to 4 do
for y := 1 to 4 do
write(matrix[x,y], ' ');
end.
它给出了错误:
Illegal expression
Expected another 3 array elements
Illegal expression
Expected another 3 array elements
你能帮助我吗?