Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
6
Добавлен:
18.07.2019
Размер:
1.32 Кб
Скачать
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, StdCtrls;

type
TForm1 = class(TForm)
StringGrid1: TStringGrid;
Button1: TButton;
Label1: TLabel;
Label2: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

const m=3; n=3;
var x:array[1..m, 1..n] of real;
i,j: byte;
Cod: integer;
LastMax, LastCol, LastRow: real;

procedure TForm1.Button1Click(Sender: TObject);
begin
StringGrid1.RowCount:=n;
StringGrid1.ColCount:=m;
LastMax:=x[i,j];
for i:=1 to n do
begin
for j:=1 to m do
begin
Val(StringGrid1.Cells[i-1,j-1],x[i,j], Cod);
if Cod<>0 then
ShowMessage('Введены некорректные данные');
end;
end;


for i:=1 to n do
begin
for j:=1 to m do
begin
if x[i,j]>LastMax then
begin
LastMax:=x[i,j];
LastCol:=i;
LastRow:=j;
end;
end;
end;
Label1.Caption:=FloatToStr(LastMax)+' является максимальным значением';
Label2.Caption:='Строка: '+FloatToStr(LastRow)+' Столбец: '+FloatToStr(LastCol);
end;

end.
Соседние файлы в папке Лаба 9 вар 9
  • #
    18.07.20192.02 Кб7Project1.dof
  • #
    18.07.2019188 б6Project1.dpr
  • #
    18.07.2019876 б6Project1.res
  • #
    18.07.20195.12 Кб6Unit1.dcu
  • #
    18.07.20191.07 Кб7Unit1.dfm
  • #
    18.07.20191.32 Кб6Unit1.pas
  • #
    18.07.2019405.74 Кб26Лаба 9.docx