![]() |
|
#1
|
|||
|
|||
![]() надо что бы матрица выводила
Код:
1 2 .. n .................... (n-2) (n-1) n (n-1) n n procedure TForm8.Button1Click(Sender: TObject); var i,k,j,n,t:byte; s: string; begin StringGrid1.Visible:=True; n:=StrToInt(edit1.Text); StringGrid1.ColCount:=n; StringGrid1.RowCount:=n; begin for j:=0 to n-1 do StringGrid1.Cells[j,0]:=inttostr(j+1); { 1 линия } end; begin for i:=0 to n do for j:=0 to n-1 do if i+j > n then begin StringGrid1.Cells[i,j]:=inttostr(n); end else StringGrid1.Cells[j,i]:=inttostr(i+j-1); end; end; у меня выводит фигню. Исправите ,пожалуйста ошибку Последний раз редактировалось Admin, 18.11.2014 в 19:14. |