Es necesario encontrar el punto de silla de la matriz, la cual es llenada por el usuario mediante el teclado.
En el siguiente código está el formato de la matriz, en el cual se pueda añadir o eliminar filas y columnas de acuerdo como quiera el usuario. ¿Cómo puedo hacer para ingresar los elementos y encontrar el punto de silla?
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
Button2: TButton;
StringGrid1: TStringGrid;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
Edit1.Text:='3';
Edit2.Text:='3';
Button1Click(Sender);
end;
procedure TForm1.Button1Click(Sender: TObject);
var i,N,M:integer;
begin
N:=StrToInt(Edit1.Text);
M:=StrToInt(Edit2.Text);
for i:=1 To N Do
StringGrid1.Cells[i,0]:=IntToStr(i);
for i:=1 To M Do
StringGrid1.Cells[0,i]:=IntToStr(i);
StringGrid1.ColCount:=N+1;
StringGrid1.RowCount:=M+1;
StringGrid1.Cells[0,0]:='Matrix';
end;
end.