Type
osoba=
record
pib:
string
[
15
];
stat:
string
[
1
];
vik, rik, stazh ,rist:
integer
;
date:
string
[
10
];
rozmpensii:
real
;
dnr:
string
[
10
];
end
;
var
f:
file
of
osoba;
z: osoba;
namefile:
string
;
nbtn2:
integer
;
procedure
TForm1
.
Button9Click(Sender: TObject);
var
i,rik_1:
integer
;
qwer,qwer1, q:
real
;
begin
rik_1:=StrToInt(Edit7
.
text);
i:=
0
;
reset(f);
seek(f,
0
);
with
StringGrid3
do
begin
cells[
0
,
0
]:=
'Прізвище'
;
cells[
1
,
0
]:=
'Стать'
;
cells[
2
,
0
]:=
'Дата народження'
;
cells[
3
,
0
]:=
'Рік виходу на пенсію'
;
cells[
4
,
0
]:=
'Трудовий стаж'
;
cells[
5
,
0
]:=
'Розмір пенсії'
;
end
;
StringGrid3
.
Show;
while
not
eof (f)
do
begin
read(f,z);
with
z
do
if
rik_1=z
.
rik
then
begin
i:=i+
1
;
StringGrid3
.
Cells[
0
,i]:=z
.
pib;
StringGrid3
.
Cells[
1
,i]:=z
.
stat;
StringGrid3
.
Cells[
2
,i]:=z
.
date;
StringGrid3
.
Cells[
3
,i]:=IntToStr(z
.
rik);
StringGrid3
.
Cells[
4
,i]:=IntToStr(z
.
stazh);
StringGrid3
.
Cells[
5
,i]:=FloatToStr(z
.
rozmpensii) ;
end
;
if
z
.
stat=
'Ч'
then
begin
for
i:=
1
to
(stringGrid3
.
rowcount-
1
)
do
begin
z
.
rozmpensii:=z
.
rozmpensii+strtofloat(stringgrid3
.
cells[
5
,i]);
end
;
qwer:=z
.
rozmpensii/( stringGrid3
.
rowcount-
1
);
Label17
.
Caption:=
'Середній розмір пенсії чоловіків складає: '
+floattostr(qwer);
end
;
if
z
.
stat=
'Ж'
then
begin
for
i:=
1
to
(stringGrid3
.
rowcount-
1
)
do
begin
z
.
rozmpensii:=z
.
rozmpensii+strtofloat(stringgrid3
.
cells[
5
,i]);
end
;
qwer1:=z
.
rozmpensii/( stringGrid3
.
rowcount-
1
);
Label18
.
Caption:=
'Середній розмір пенсії жінок складає: '
+floattostr(qwer1);
end
;
CloseFile(f);
Button10
.
Show;
end
;
end
;