procedure
TForm1
.
Button1Click(Sender: TObject);
var
j,i:
integer
;
s, d, b, c:
real
;
begin
S :=
0
;
for
j :=
1
to
StringGrid1
.
RowCount -
1
do
begin
if
stringgrid1
.
cells[
1
,j]=
''
then
stringgrid1
.
cells[
1
,j]:=
'0'
;
if
stringgrid1
.
cells[
3
,j]=
''
then
stringgrid1
.
cells[
3
,j]:=
'0'
;
if
stringgrid1
.
cells[
3
,j]<=
'1'
then
begin
d:=StrToFloat(StringGrid1
.
Cells [
3
,j]) *
StrToFloat(StringGrid1
.
Cells [
1
,j]);
s := s + d;
edit1
.
text:=Floattostr(s);
end
else
begin
label2
.
visible:=
true
;
label2
.
caption:=
'Неверное значение r(i)'
;
end
;
begin
B :=
0
;
for
i:=
1
to
stringGrid1
.
RowCount -
1
do
b:= StrToFloat(StringGrid1
.
Cells [
3
,i]) *
StrToFloat(StringGrid1
.
Cells [
2
,i]);
b:=c+b;
edit2
.
text:=Floattostr(b);
end
;