Вот вся прога
Код
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids, Menus, Buttons;
type
TForm1 = class(TForm)
StringGrid1: TStringGrid;
StringGrid2: TStringGrid;
StringGrid3: TStringGrid;
MainMenu1: TMainMenu;
N1: TMenuItem;
PreobrF: TMenuItem;
ReadF: TMenuItem;
CreatF: TMenuItem;
ProsmotrG: TMenuItem;
N5: TMenuItem;
N6: TMenuItem;
Label1: TLabel;
Label2: TLabel;
BitBtn1: TBitBtn;
Button1: TButton;
Memo1: TMemo;
Button2: TButton;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
Type matr=array[1..2,1..3] of real;
var
matriza:matr;
f,g:file of matr;
max:real;
n:integer;
procedure TForm1.Button1Click(Sender: TObject);
var i,j,n,str,k:integer;
s:string;
begin
AssignFile(f,'c:\f.matr');
rewrite(f);
n:=-3;
str:=memo1.Lines.Count;
For k:=1 to str-1 do begin
inc(n,3);
label1.Caption:=inttostr(n);
for i:=1 to 2 do begin
s:=memo1.Lines[i+n];
for j:=1 to 3 do
matriza[i,j]:=strtoint(s[j]);
write(f,matriza);
end;
end;
closeFile(f);
end;
end.