if StringGrid2.Focused then StringGrid2.RowCount:=StringGrid2.RowCount-1;
end;
procedure TForm4.N3Click(Sender: TObject);
Var
Myfile : Textfile;
Date : String;
begin
If (saveDialog1.Execute) then begin
AssignFile(Myfile,Savedialog1.FileName);
Try Rewrite(myFile);
Except
Showmessage('Îøèáêà ïðè ÷òåíèè ôàéëà!'); Exit;
Date:=IntToStr(StringGrid1.RowCount);WriteLn(MyFile,Date);
Date:=IntToStr(StringGrid2.RowCount);WriteLn(MyFile,Date);
For j:=0 to n do begin
For i:=0 to StringGrid1.RowCount-1 do begin
Date:=StringGrid1.Cells[j,i];
WriteLn(Myfile,Date);
For i:=0 to StringGrid2.RowCount-1 do begin
Date:=StringGrid2.Cells[j,i];
Closefile(myFile);
end
else Begin Showmessage('Îøèáêà!'); Exit;end;
procedure TForm4.N2Click(Sender: TObject);
If (OpenDialog1.Execute) then begin
AssignFile(Myfile,Opendialog1.FileName);
Try Reset(myFile);
ReadLn(MyFile,Date);StringGrid1.RowCount:=StrToInt(Date);
ReadLn(MyFile,Date);StringGrid2.RowCount:=StrToInt(Date);
ReadLn(MyFile,Date);
StringGrid1.Cells[j,i]:=Date;
StringGrid2.Cells[j,i]:=Date;
else Begin Showmessage('Ôàéë íå íàéäåí!'); Exit;end;
procedure TForm4.N7Click(Sender: TObject);
var
str,str2 : string;
k : integer;
for t:=1 to n do begin
for j:=1 to 3 do begin
PlusSi[j,t]:=0;
for i:=1 to StringGrid1.RowCount-1 do begin
str:=StringGrid1.Cells[t,i];
if pos(';',str)<>0 then begin str2:='';k:=1;
for j:=1 to Length(str)do begin
if (str[j]<>';') then str2:=str2+str[j]
else begin
PlusSi[k,t]:=PlusSi[k,t]+StrToFloat(str2);
k:=k+1;str2:='';
if j=Length(str) then PlusSi[k,t]:=PlusSi[k,t]+StrToFloat(str2);
end else try
PlusSi[1,t]:=PlusSi[1,t]+StrToFloat(str);
PlusSi[2,t]:=PlusSi[2,t]+StrToFloat(str);
PlusSi[3,t]:=PlusSi[3,t]+StrToFloat(str);
except
showmessage('Îøèáêà ïðè ââîäå çíà÷åíèé èíòåðâàëîâ äåíåæíûõ ïîòîêîâ!');
FocusControl(Stringgrid1);
for i:=1 to StringGrid2.RowCount-1 do begin
str:=StringGrid2.Cells[t,i];
if k=1 then PlusSi[3,t]:=PlusSi[3,t]-StrToFloat(str2);
if k=2 then PlusSi[2,t]:=PlusSi[2,t]-StrToFloat(str2);
if j=Length(str) then PlusSi[1,t]:=PlusSi[1,t]-StrToFloat(str2);
PlusSi[1,t]:=PlusSi[1,t]-StrToFloat(str);
PlusSi[2,t]:=PlusSi[2,t]-StrToFloat(str);
PlusSi[3,t]:=PlusSi[3,t]-StrToFloat(str);
for i:=1 to n do begin
str:='';
str:=str+FloatToStr(PlusSi[j,i]);
if j<>3 then str:=str+';';
Form1.StringGrid1.Cells[i-1,1]:=str;
end.
unit Risk;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, Grids, ExtCtrls, Buttons, Spin, Menus;
type
TForm8 = class(TForm)
PageControl1: TPageControl;
TabSheet1: TTabSheet;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
StringGrid1: TStringGrid;
StringGrid2: TStringGrid;
TabSheet2: TTabSheet;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
StringGrid3: TStringGrid;
StringGrid4: TStringGrid;
TabSheet3: TTabSheet;
Label8: TLabel;
StringGrid6: TStringGrid;
Label9: TLabel;
StringGrid7: TStringGrid;
StringGrid8: TStringGrid;
Label10: TLabel;
Panel3: TPanel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
SpinEdit1: TSpinEdit;
SpinEdit2: TSpinEdit;
Edit1: TEdit;
Edit2: TEdit;
OpenDialog1: TOpenDialog;
SaveDialog1: TSaveDialog;
CheckBox1: TCheckBox;
MainMenu1: TMainMenu;
N1: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
N6: TMenuItem;
N7: TMenuItem;
N5: TMenuItem;
N9: TMenuItem;
CheckBox2: TCheckBox;
Label7: TLabel;
procedure SpinEdit1Change(Sender: TObject);
procedure SpinEdit2Change(Sender: TObject);
procedure Edit1Exit(Sender: TObject);
procedure Edit2Exit(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure CheckBox1Click(Sender: TObject);
procedure N7Click(Sender: TObject);
procedure N4Click(Sender: TObject);
procedure N5Click(Sender: TObject);
procedure N9Click(Sender: TObject);
procedure CheckBox2Click(Sender: TObject);
procedure StringGrid1KeyPress(Sender: TObject; var Key: Char);
procedure StringGrid2KeyPress(Sender: TObject; var Key: Char);
procedure StringGrid3KeyPress(Sender: TObject; var Key: Char);
procedure StringGrid4KeyPress(Sender: TObject; var Key: Char);
procedure StringGrid6KeyPress(Sender: TObject; var Key: Char);
procedure StringGrid7KeyPress(Sender: TObject; var Key: Char);
procedure StringGrid8KeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
public
{ Public declarations }
Form8: TForm8;
Ct,At,Zt,Simd : array[1..20] of real;{êðèòåðèé ïîêðûòèÿ,ñîá.êàïèòàë,çàåìíûé êàï.,ìàò.îæ.äåí.ïîòîêîâ(ïðîãíîçèð.äåí.ïîòîêè)}
Pfsr : real; {ñð.çí.öåíû}
Sij,Vt : array[1..20] of real;{÷èñò.äåí.ïîòîêè,ðèñê,}
Rt : array[1..20] of real;{êð.ëèêâèäíîñòè}
n,i,j,f,l,ii : integer; {÷èñëî ÏÓÏ,÷èñëî ðåñóðñîâ,}
d,NPV,NPVi,NPVj,s,sum,sum2,sum3,ENPV : real; {êîýô.äèñêîíòèðîâàíèÿ,×ÏÝ,ìàò.îæ.NPV}
Ip : real; {ïåðâîíà÷.êàï.âëîæåíèÿ}
Pf : array[1..20,1..20] of real; {öåíà íà ðåñóðñ â êàæäûé ÏÓÏ, }
Pkrit,Xf : array[1..20] of real; {Êðèòè÷åñêèé ëèìèò öåíû,äîëÿ ðåñóðñà â ïîðòôåëå ðåñóðñîâ}
implementation
uses Results,Cov, PriceCov, Riskproject, normgenerator;
{$R *.dfm}
procedure TForm8.SpinEdit1Change(Sender: TObject);
n:=SpinEdit1.Value;
StringGrid1.ColCount:=n; StringGrid2.ColCount:=n; StringGrid3.ColCount:=n; StringGrid4.ColCount:=n;
Stringgrid7.RowCount:=n+1; Form3.StringGrid1.ColCount:=n+1;Form3.Stringgrid1.RowCount:=n+1;
Form4.StringGrid1.ColCount:=n+1; Form4.Stringgrid1.RowCount:=n+1;
Form7.StringGrid1.ColCount:=n+3; Form7.StringGrid2.ColCount:=n+2;Form7.StringGrid3.ColCount:=n+1;
For i:=1 to n do begin
Stringgrid1.Cells[i-1,0]:=IntToStr(i); Stringgrid2.Cells[i-1,0]:=IntToStr(i);
Stringgrid3.Cells[i-1,0]:=IntToStr(i); Stringgrid4.Cells[i-1,0]:=IntToStr(i);
Form3.Stringgrid1.Cells[i,0]:=IntToStr(i);Form3.Stringgrid1.Cells[0,i]:=IntToStr(i);
Form4.Stringgrid1.Cells[i,0]:=IntToStr(i); Form4.Stringgrid1.Cells[0,i]:=IntToStr(i);
Form7.StringGrid1.Cells[i+2,0]:=IntToStr(i); Form7.StringGrid2.Cells[i+1,0]:=IntToStr(i);
Form7.StringGrid3.Cells[i,0]:=IntToStr(i); Stringgrid7.Cells[0,i]:=IntToStr(i);
procedure TForm8.SpinEdit2Change(Sender: TObject);
f:=SpinEdit2.Value;
StringGrid6.ColCount:=f;StringGrid7.ColCount:=f+1;
StringGrid7.RowCount:=n+1; StringGrid8.ColCount:=f;
For i:=1 to f do begin
Stringgrid6.Cells[i-1,0]:=IntToStr(i);
Stringgrid7.Cells[i,0]:=IntToStr(i);
Stringgrid8.Cells[i-1,0]:=IntToStr(i);
For i:=1 to n+1 do begin
StringGrid7.Cells[0,i]:=IntToStr(i);
procedure TForm8.Edit1Exit(Sender: TObject);
try
d:=StrToFloat(Edit1.Text);
Showmessage('Íåïðàâåëüíûé ââîä äàííûõ!');
procedure TForm8.Edit2Exit(Sender: TObject);
Ip:=StrToFloat(Edit2.Text);
procedure TForm8.FormCreate(Sender: TObject);
n:=5;f:=5;d:=1.2;Ip:=10;
For i:=1 to 5 do begin
Stringgrid6.Cells[i-1,0]:=IntToStr(i); Stringgrid7.Cells[0,i]:=IntToStr(i);
StringGrid7.Cells[i,0]:=IntToStr(i); Stringgrid8.Cells[i-1,0]:=IntToStr(i);
For i:=1 to 20 do begin
For j:=1 to 20 do begin
Pcovar[i,j]:=0;
Covar[i,j]:=0;
procedure TForm8.CheckBox1Click(Sender: TObject);
if checkBox1.Checked then Form4.Show;
procedure TForm8.N7Click(Sender: TObject);
keyw: boolean;
// Çàïîëíåíèå äàííûõ â ìàññèâû
keyw:=true;
For i:=0 to n-1 do begin
Zt[i+1]:=StrToFloat(StringGrid1.Cells[i,1]);
At[i+1]:=StrToFloat(StringGrid2.Cells[i,1]);
Simd[i+1]:=StrToFloat(Stringgrid3.Cells[i,1]);
Sij[i+1]:=StrToFloat(Stringgrid4.Cells[i,1]);
s:=0;
Pkrit[i]:=StrToFloat(Stringgrid8.Cells[i-1,1]);
Xf[i]:= StrToFloat(Stringgrid6.Cells[i-1,1]);
s:=s+Xf[i];
if s<>1 then begin
Showmessage('Îáùÿÿ ñóììà äîëåé ðåñóðñîâ â ïîðòôåëå äîëæíà áûòü ìåíüøå ðàâíà åäèíèöå!');
keyw:=false;
PageControl1.ActivePage:=TabSheet3;
FocusControl(StringGrid6);
For j:=1 to f do begin
Pf[i,j]:=StrToFloat(Stringgrid7.Cells[j,i]);
ShowMessage('Íåïðàâèëüíî çàïîëíåíû ïîëÿ!');
if keyw=true then begin
// --------------------------------âû÷èñëåíèå ìàò. îæ. NPV
ENPV:=0;
For i:=1 to n do begin NPV:=0;
For j:=1 to i do begin
NPV:=NPV+Sij[j];
NPV:=NPV/i;s:=1;
for j:=1 to i do begin s:=s*d;end;
ENPV:=ENPV+(NPV/s);
ENPV:=ENPV-Ip;
//----------------------------------âû÷èñëåíèå êðèòåðèÿ ïîêðûòèÿ Ct
if Zt[i]<>0 then Ct[i]:=At[i]/Zt[i] else Ct[i]:=0;
For i:=0 to Form2.StringGrid1.ColCount-1 do begin
Form2.StringGrid1.ColWidths[i]:=Form2.Header1.SectionWidth[i]-1;
//-----------------------------------âû÷èñëåíèå êðèòåðèÿ ëèêâèäíîñòè Rt â òîì ÷èñëå
//-----------------------------------è NPVt
NPV:=0;s:=d;
For j:=1 to i-1 do begin s:=s*d;end;
NPV:=NPV+(Simd[i]/s); s:=d;
NPV:=NPV-Ip; // ïðîãíîçíîå NPV
For i:=1 to n-1 do begin
NPVi:=0;NPVj:=0;s:=d;
for j:=1 to i do begin
For l:=1 to j-1 do begin s:=s*d; end;
NPVi:=NPVi+(Sij[j]/s);s:=d; //òî NPV, êîòîðîå ïîëó÷àåì ïî èìåþù. äàííûì
s:=d;
for j:=i+1 to n do begin
NPVj:=NPVj+(Simd[j]/s);s:=d;
NPVj:=NPVj-Ip; //òî, ÷òî îñòàëîñü îò ïðîãíîãçíîãî NPV
Rt[i]:=(NPVi+NPVj)/NPV;
Form2.StringGrid1.Cells[2,i-1]:=FloatToStr(NPVi);
NPVi:=0;s:=d;
For l:=1 to i-1 do begin s:=s*d; end;
NPVi:=NPVi+(Sij[i]/s);s:=d;
Rt[n]:=NPVi/NPV;Form2.StringGrid1.Cells[2,n-1]:=FloatToStr(NPVi);
Form2.StringGrid1.RowCount:=n;
Form2.StringGrid1.Cells[0,i]:=IntToStr(i+1);
Form2.StringGrid1.Cells[1,i]:=FloatToStr(Ct[i+1]);
Form2.StringGrid1.Cells[3,i]:=FloatToStr(Rt[i+1])
Form2.Memo1.Lines.Clear;
Form2.Memo1.Lines.Add('E(NPV) = ' + FloatToStr(ENPV) + ';');
// Îöåíêà îáùåãî ðèñêà ïðîåêòà
Pfsr:=0;
Pfsr:=Pfsr+Pf[i,j];
Pfsr:=Pfsr/n;
if Pfsr>Pkrit[j] then
Form2.Memo1.Lines.Add('Ïîêóïêà ' + IntToStr(j) + '-ãî ðåñóðñà íåâûãîäíà');
sum:=0;s:=1;
For l:=1 to 2*j do begin s:=s*d; end;
sum:=sum+(Covar[j,j]/s);s:=1;
sum2:=0;sum3:=0;
for l:=1 to i-1 do begin
for j:=l+1 to i do begin
s:=1;
For ii:=1 to l+j do begin s:=s*d; end;
sum2:=sum2+(Covar[l,j]/s);
for l:=1 to i do begin
sum3:=sum3+(Xf[l]*Xf[j]*PCovar[l,j])
Vt[i]:=sum+(2*sum2)+sum3;
form2.StringGrid1.Cells[4,i-1]:=FloatToStr(Vt[i]);
Form2.Show;
procedure TForm8.N4Click(Sender: TObject);
With Form1 do begin
ReadLn(MyFile,Date);SpinEdit1.Value:=StrToInt(Date);n:=StrToInt(Date);
ReadLn(MyFile,Date);SpinEdit2.Value:=StrToInt(Date);f:=StrToInt(Date);
ReadLn(MyFile,Date);Edit1.Text:=Date;d:=StrToFloat(Date);
ReadLn(MyFile,Date);Edit2.Text:=Date;Ip:=StrToFloat(Date);
StringGrid1.Cells[i,1]:=Date;
StringGrid2.Cells[i,1]:=Date;
End;
StringGrid3.Cells[i,1]:=Date;
StringGrid4.Cells[i,1]:=Date;
For i:=0 to f-1 do begin
StringGrid6.Cells[i,1]:=Date;
StringGrid7.Cells[i,j]:=Date;
StringGrid8.Cells[i,1]:=Date;
With Form3 do begin
For j:=1 to n do begin
StringGrid1.Cells[i,j]:=Date;
BitBtn1Click(Sender);
With Form4 do begin
procedure TForm8.N5Click(Sender: TObject);
With Form8 do begin
Date:=IntToStr(SpinEdit1.Value);WriteLn(MyFile,Date);
Date:=IntToStr(SpinEdit2.Value);WriteLn(MyFile,Date);
Date:=Edit1.Text;WriteLn(MyFile,Date);
Date:=Edit2.Text;WriteLn(MyFile,Date);
Date:=StringGrid1.Cells[i,1];
Date:=StringGrid2.Cells[i,1];
Date:=StringGrid3.Cells[i,1];
Date:=StringGrid4.Cells[i,1];
{For i:=0 to n-1 do begin
Date:=StringGrid5.Cells[i,1];
End; }
Date:=StringGrid6.Cells[i,1];
for j:=1 to f do begin
Date:=StringGrid7.Cells[i,j];
Date:=StringGrid8.Cells[i,1];
Date:=StringGrid1.Cells[i,j];
procedure TForm8.N9Click(Sender: TObject);
Form7.show;
procedure TForm8.CheckBox2Click(Sender: TObject);
if checkBox2.Checked then Form3.Showmodal;
procedure TForm8.StringGrid1KeyPress(Sender: TObject; var Key: Char);
Case key of
chr(48),chr(49),chr(50),chr(51),chr(52),chr(53),chr(54), chr(55),chr(56),chr(57),chr(44):;
else key:=chr(0);end;
procedure TForm8.StringGrid2KeyPress(Sender: TObject; var Key: Char);
else key:=chr(0); end;
procedure TForm8.StringGrid3KeyPress(Sender: TObject; var Key: Char);
procedure TForm8.StringGrid4KeyPress(Sender: TObject; var Key: Char);
chr(48),chr(49),chr(50),chr(51),chr(52),chr(53),chr(54), chr(55),chr(56),chr(57),chr(44),chr(45):;
procedure TForm8.StringGrid6KeyPress(Sender: TObject; var Key: Char);
procedure TForm8.StringGrid7KeyPress(Sender: TObject; var Key: Char);
procedure TForm8.StringGrid8KeyPress(Sender: TObject; var Key: Char);
unit normgenerator;
Dialogs, Grids, StdCtrls, ExtCtrls, ComCtrls, Buttons, Menus;
procedure normgen(var num1,num2 : real);
TForm7 = class(TForm)
GroupBox1: TGroupBox;
N2: TMenuItem;
procedure StringGrid1Exit(Sender: TObject);
procedure StringGrid2Exit(Sender: TObject);
procedure N3Click(Sender: TObject);
procedure N2Click(Sender: TObject);
Form7: TForm7;
i,j, ndvar : integer; {÷èñëî äòåðì. ïåðåì-õ ïðîåêòà}
Svar : array[1..500,1..20] of real;{ìàññèâ çíà÷åíèé ñãåíåðèðîâàííûõ ñë.âåë}
Xvar : array[1..40,1..20] of real; {ìàññèâ ñë.ïåðåìåí-õ ïðîåêòà}
Dvar : array[1..20,1..20] of real; {ìàññèâ äåòåðìèèðîâàííûõ ïåðåì-õ äåí. ïîòîêîâ}
uses Risk, Cov;
r1,r2,svar : real;
Repeat
r1:=2*random-1;
r2:=2*random-1;
svar:=Sqr(r1)+Sqr(r2);
Until (svar<1);
svar:=sqrt((-2*ln(svar))/svar);
num1:=r1*svar;
num2:=r2*svar;
procedure TForm7.N2Click(Sender: TObject);
ReadLn(MyFile,Date);StringGrid1.ColCount:=StrToInt(Date);
ReadLn(MyFile,Date);StringGrid2.ColCount:=StrToInt(Date);
For i:=0 to StringGrid1.ColCount do begin
For j:=0 to StringGrid1.RowCount do begin
For i:=0 to StringGrid2.ColCount do begin
For j:=0 to StringGrid2.RowCount do begin
StringGrid2.Cells[i,j]:=Date;
procedure TForm7.FormCreate(Sender: TObject);
StringGrid1.Cells[0,1]:='+'; StringGrid1.Cells[0,3]:='-'; StringGrid1.Cells[0,5]:='-';
StringGrid2.Cells[0,1]:='+'; StringGrid2.Cells[0,2]:='+'; StringGrid2.Cells[0,3]:='-'; StringGrid2.Cells[0,4]:='-';
StringGrid1.Cells[1,1]:='Äîõîäû îò ðåàëèçàöèè ïðîäóêöèè';
StringGrid1.Cells[1,3]:='Ýêñïëóòàöèîííûå çàòðàòû';
StringGrid1.Cells[1,5]:='Íàëîãè';
StringGrid2.Cells[1,1]:='Âîçìåùåíèå ÍÄÑ ïî èíâåñòèöèÿì';
StringGrid2.Cells[1,2]:='Àìîðòèçàöèÿ';
StringGrid2.Cells[1,3]:='Èíâåñòèöèè';
StringGrid2.Cells[1,4]:='Ïðèðîñò îáîðîòíûõ ñðåäñòâ';
StringGrid1.Cells[1,0]:='Íàçâàíèå';
StringGrid1.Cells[2,0]:='Èíò-ë';
StringGrid2.Cells[1,0]:='Íàçâàíèå';
i:=1;
While (i<=StringGrid1.ColCount) do begin
StringGrid1.Cells[2,i]:='Ìèí.';
StringGrid1.Cells[2,i+1]:='Ìàêñ.';
i:=i+2;
For i:=3 to StringGrid1.ColCount do begin
StringGrid1.Cells[i,0]:=IntToStr(i-2);
StringGrid2.Cells[i-1,0]:=IntToStr(i-2);
StringGrid3.Cells[i-2,0]:=IntToStr(i-2);
For i:=1 to 500 do begin
Stringgrid3.Cells[0,i]:=IntToStr(i);
procedure TForm7.N7Click(Sender: TObject);
nvar,nn1,nn2,sv1,sv2 : real; //÷èñëî ñòîõ.ïåð-õ ïðîåêòà,ñë.÷èñëà,êîýô-òû äëÿ ïðèðîñòà îá.ñð-â.
kvar : integer;
nvar:=StringGrid1.RowCount-1;
Simd[j]:=0;
Svar[i,j]:=0;
for i:=1 to (StringGrid1.ColCount-3) do begin
j:=1;
While j<=(nvar-1) do begin
kvar:=1;
While kvar<=500 do begin
normgen(nn1,nn2);
nn1:=Xvar[j,i]+nn1*Xvar[j+1,i];
nn2:=Xvar[j,i]+nn2*Xvar[j+1,i];
if StringGrid1.Cells[0,j]='-' then begin
nn1:=-nn1;
nn2:=-nn2;
if j=5 then begin
if Xvar[j,i]<>0 then begin
sv1:=nn1/Xvar[j,i];
sv2:=nn2/Xvar[j,i];
end else begin sv1:=0; sv2:=0; end;
Svar[kvar,i]:=Svar[kvar,i]+sv1*Dvar[4,i];
Svar[kvar+1,i]:=Svar[kvar+1,i]+sv2*Dvar[4,i];
Svar[kvar,i]:=Svar[kvar,i]+nn1;
Svar[kvar+1,i]:=Svar[kvar+1,i]+nn2;
kvar:=kvar+2;
j:=j+2;
for j:=1 to 500 do begin
For kvar:=1 to ndvar do begin
if kvar <>4 then Svar[j,i]:=Svar[j,i]+Dvar[kvar,i];
For i:=1 to StringGrid1.Colcount-3 do begin
For j:=1 to 500 do begin
StringGrid3.Cells[i,j]:=FloatToStr(Svar[j,i]);
Simd[i]:=Simd[i]+Svar[j,i];
Simd[i]:=Simd[i]/500;
Form8.StringGrid3.Cells[i-1,1]:=FloatToStrF(Simd[i],ffFixed,9,2);
For i:=1 to StringGrid1.ColCount-3 do begin
For j:=i to StringGrid1.ColCount-3 do begin
For kvar:=1 to 500 do begin
Covar[i,j]:=Covar[i,j]+((Svar[kvar,i]-Simd[i])*(Svar[kvar,j]-Simd[j]));
Covar[i,j]:=Covar[i,j]/500;
Form3.StringGrid1.Cells[j,i]:=FloatToStrF(Covar[i,j],ffFixed,12,2);
Form3.StringGrid1.Cells[i,j]:=FloatToStrF(Covar[i,j],ffFixed,12,2);
procedure TForm7.StringGrid1Exit(Sender: TObject);
Try
For j:=3 to StringGrid1.ColCount-1 do begin
While i<=StringGrid1.RowCount-1 do begin
Xvar[i,j-2]:=StrToFloat(StringGrid1.Cells[j,i]);
Xvar[i,j-2]:=(Xvar[i,j-2]+StrToFloat(StringGrid1.Cells[j,i+1]))/2;
Xvar[i+1,j-2]:=Xvar[i,j-2]-StrToFloat(StringGrid1.Cells[j,i]);
ShowMessage('Íåïðàâåëüíûé ââîä äàííûõ!');
FocusControl(StringGrid1);
procedure TForm7.StringGrid2Exit(Sender: TObject);
nn1 : real;
For j:=2 to StringGrid2.ColCount-1 do begin
For i:=1 to StringGrid2.RowCount-1 do begin
Dvar[i,j-1]:=StrToFloat(StringGrid2.Cells[j,i]);
If StringGrid2.Cells[0,i]='-' then Dvar[i,j-1]:=-Dvar[i,j-1]
FocusControl(StringGrid2);
ndvar:=StringGrid2.RowCount-1;
procedure TForm7.N3Click(Sender: TObject);
Date:=IntToStr(StringGrid1.ColCount);WriteLn(MyFile,Date);
Date:=IntToStr(StringGrid2.ColCount);WriteLn(MyFile,Date);
for j:=0 to StringGrid1.RowCount do begin
Date:=StringGrid2.Cells[i,j];
Ñòðàíèöû: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13