unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, StdCtrls;
const
a3='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
a4='1234567890';
a5='+-=';
type
TForm1 = class(TForm)
StringGrid1: TStringGrid;
Edit1: TEdit;
Button1: TButton;
Button2: TButton;
Edit2: TEdit;
StringGrid2: TStringGrid;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
a1:array [0..9] of string[60];
a2:array [0..10,0..9] of real;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
if Edit1.Text='' then
Edit1.Text:='Vvedite 4islo yravnenii'
else
StringGrid1.RowCount := StrToInt(Edit1.Text);
end;
procedure TForm1.Button2Click(Sender: TObject);
var x,x1:string;
aa:array[0..10,0..9] of real;
b,c,i,j,p,m,k,na4,kon,kol,l:integer;
x2:real;
begin
m:=0;
x2:=0;
kol:=0;
na4:=0;
kon:=0;
if StringGrid1.Cells[0,0]='' then
StringGrid1.Cells[0,0]:='Vvedite tekst'
else
for i:=0 to StrToInt(Edit1.Text) do
begin
a1[i]:=StringGrid1.Cells[0,i];
for j:=1 to StrToInt(Edit1.Text) do
if (a1[i,j]='+') or (a1[i,j]='-') then
begin
na4:=j;
kol:=kol+1;
if (kol=2) and (a1[i,j]='+') or (a1[i,j]='-') or (a1[i,j]='=') then
kon:=j;
end;
for j:=na4 to kon do
for l:=1 to length(a3) do
if a1[i,j]=a3[l] then
begin
for k:=j downto 1 do
if (a1[i,k]=a4[i+1]) or (a1[i,k]=',') then
begin
x:=x+a1[i,k];
a2[(strtoint(a1[i,j+1])),j]:=strtofloat(x);
end
else for p:=1 to length(a4) do
begin
if (a1[i,m]=a4[p]) or (a1[i,m]=',') then
x1:=x1+a4[p];
end;
if (a1[i,j+1]='=') or (a1[i,j+1]='=') and (a1[i,j+1]=' ') then
x2:=x2 - strtofloat(a1[i,j+2]);
a2[10,i]:=(x2);
for b:=0 to StrToInt(Edit1.Text) do
begin
for c:=0 to 60 do
StringGrid2.Cells[b,c]:=floattostr(a2[b,c]);
end;
end;
end;
end;
end.