Контрольная работа: Разработка программного комплекса
begin
DecodeDate(Now,y2,m2,d2);
MStch := 0;
WStch := 0;
for i := 1 to StringGrid1.RowCount - 2 do
begin
TableRowToWorker(i,StringGrid1);
DecodeDate(Worker.BirthDay,y1,m1,d1);
if (Worker.sex = 0) then
begin
MAge := MAge + y2 - y1;
MStch := MStch +1;
end
else
begin
WAge := WAge + y2 - y1;
WStch := WStch +1;
end;
end;
MAge := MAge / MStch;
WAge := WAge / WStch;
Form5.Label3.Caption := FloatToStrF(MAge,ffGeneral, 8, 2);
Form5.Label4.Caption := FloatToStrF(WAge,ffGeneral, 8, 2);
Form5.ShowModal;
end
else
if ComboBox1.ItemIndex = 2 then
begin
SetLength(Workers, StringGrid1.RowCount - 1);