D
D
Danil2019-05-04 21:56:06
Pascal
Danil, 2019-05-04 21:56:06

How, instead of the standard output of an array on the screen, display an array in a TMemo field?

Please help me rewrite the code in such a way as to get the output of the array in the TMemo field.
The code:

for i:=1 to n do begin
    for j:=1 to n do write(A[i,j]:3);
    writeln;
end;

I did like this, but it doesn't work:
for i:=1 to n do begin
    for j:=1 to n do MemoMS.Text:=MemoMS.Text + IntToStr(A[i,j]:3);
    MemoMS.Text:=MemoMS.Text + #13#10;
end;

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stockholm Syndrome, 2019-05-05
@OnlyGoRush

var 
  str: string;
begin
  str := '';
  for i := 1 to n do begin
    for j := 1 to n do begin
      str := str + '   ' + IntToStr(A[i, j]);
    end;
    MemoMS.Lines.Add(str);
    str := ''; 
  end;
end;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question