unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Grids, XPMan, StdCtrls, Spin, Buttons, Menus, jpeg, ExtCtrls; type TForm1 = class(TForm) Label1: TLabel; SpinEdit1: TSpinEdit; Label2: TLabel; SpinEdit2: TSpinEdit; Label3: TLabel; StringGrid1: TStringGrid; Label4: TLabel; Edit1: TEdit; BitBtn3: TBitBtn; BitBtn2: TBitBtn; BitBtn1: TBitBtn; Image1: TImage; BitBtn4: TBitBtn; BitBtn5: TBitBtn; procedure BitBtn2Click(Sender: TObject); procedure BitBtn3Click(Sender: TObject); procedure BitBtn1Click(Sender: TObject); { Private declarations } public { Public declarations } end; type ar=array [1..10,1..10] of integer; var Form1: TForm1; f:file of ar; a:ar; i,j: byte; FlagS,FlagI:boolean; S,G: integer; implementation {$R *.dfm} procedure TForm1.BitBtn2Click(Sender: TObject); //кнопка ok begin for i:=1 to spinedit1.Value do for j:=1 to spinedit2.Value do begin a[i,j]:=StrToInt(form1.StringGrid1.Cells[j-1,i-1]); //преобразует строку в числовой формат end; Begin FlagS:=true; //проверка на сюръекцию for i:=1 to spinedit1.Value do begin S:=0; for j:=0 to spinedit2.Value do S:=S+a[i,j]; if S=0 then FlagS:=false; end; begin FlagI:=true; //проверка на инъекцию for j:=1 to spinedit2.Value do begin G:=0; for i:=0 to spinedit1.Value do G:=G+a[i,j]; if G>1 then FlagI:=false; end; begin if (spinedit1.Value=spinedit2.Value) and (FlagS=true) and (FlagI=true) then begin Edit1.Text:='Биекция'; exit;end; if (FlagS=false) and (FlagI=false) or (FlagS=true) and (FlagI=true) then begin Edit1.Text:='Общего вида'; end; if (FlagS=true) then begin Edit1.Text:='Сюрьекция'; end; if (FlagI=true) then begin Edit1.Text:='Иньекция';end; end; end; end; end; procedure TForm1.BitBtn3Click(Sender: TObject); begin if (spinedit1.Value<1) or (spinedit2.Value<1) or (spinedit1.Value>10) or (spinedit2.Value>10) then begin stringGrid1.Enabled:=false; BitBtn3.Enabled:=false; MessageDlg ('Количество строк и столбцов не должно превышать 10 и не должно быть меньше 1',mtInformation,[mbOK],0); BitBtn3.Enabled:=true; end else begin stringGrid1.Enabled:=true; BitBtn3.Enabled:=true; stringGrid1.RowCount:=spinedit1.Value; stringGrid1.ColCount:=spinedit2.Value; end; end; procedure TForm1.BitBtn1Click(Sender: TObject); begin Close; end; end; end.