Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- procedure TForm5.N2Click(Sender: TObject);
- var
- inputFile: TextFile;
- temp, i,j: integer;
- begin
- if Open.Execute then
- begin
- try
- AssignFile(inputFile, Open.FileName);
- Reset(inputFile);
- n := 0;
- ReadLn(inputFile, n);
- SG.ColCount := n + 1;
- SG.RowCount := n + 1;
- if SeekEof(inputFile) then
- begin
- MessageDlg('Данный файл пустой. Попробуйте снова.', mtError, [mbRetry], 0);
- CloseFile(inputFile);
- end
- else
- begin
- for i:= 1 to n do
- for j:= 1 to n do
- begin
- Read(InputFile, temp);
- SG.Cells[j,i]:= IntToStr(temp);
- end;
- CloseFile(inputFile);
- end;
- except
- MessageDlg('Проверьте введенные данные.', mtError, [mbRetry], 0);
- CloseFile(inputFile);
- end;
- for i:= 1 to n do
- begin
- SG.Cells[i,0] := IntToStr(i);
- SG.Cells[0,i] := IntToStr(i);
- end;
- end;
- end;
Advertisement
Add Comment
Please, Sign In to add comment