interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Buttons, StdCtrls, Grids, Spin, ExtCtrls;
type
TForm1 =
class
(TForm)
Button1: TButton;
win: TLabel;
Edit2: TEdit;
StringGrid1: TStringGrid;
SpinEdit1: TSpinEdit;
SpinEdit2: TSpinEdit;
Label2: TLabel;
Label3: TLabel;
Button2: TButton;
RadioGroup1: TRadioGroup;
Label1: TLabel;
Edit1: TEdit;
procedure
Button1Click(Sender: TObject);
procedure
SpinEdit1Change(Sender: TObject);
procedure
SpinEdit2Change(Sender: TObject);
procedure
Button2Click(Sender: TObject);
procedure
FormCreate(Sender: TObject);
procedure
draw;
private
public
end
;
var
Form1: TForm1;
s,p:
string
;
m:
array
[
1..99999
]
of
real
;
i,n,k,g,o,j,ty,rt,max,min:
integer
;
r,c,L:
real
;
implementation
{$R *.dfm}
procedure
TForm1
.
draw;
begin
end
;
procedure
TForm1
.
Button1Click(Sender: TObject);
begin
try
for
j:=
1
to
StringGrid1
.
RowCount-
1
do
begin
s:=
''
;
for
ty:=
1
to
StringGrid1
.
ColCount-
1
do
if
StringGrid1
.
cells[ty,j]<>
''
then
s:=s+StringGrid1
.
Cells[ty,j]+
' '
;
if
s<>
''
then
begin
n:=
0
;
k:=
0
;
i:=StrToInt(copy(s,
1
,pos(
' '
,s)-
1
));
delete(s,
1
,pos(
' '
,s));
while
pos(
' '
,s)>
0
do
begin
p:=copy(s,
1
,pos(
' '
,s)-
1
);
k:=k+StrToInt(p);
delete(s,
1
,pos(
' '
,s));
n:=n+
1
;
end
;
r:=k/(n-
1
);
m[i]:=r;
end
;
end
;
c:=m[
1
];
o:=
0
;
For
g:=
2
to
i
do
begin
if
c<m[g]
then
begin
c:=m[g];
o:=g;
end
;
end
;
Form1
.
Edit2
.
Text:=IntToStr(o);
L:=max(Edit1*min)+(
1
-Edit1)*max)
except
end
;
end
;
procedure
TForm1
.
SpinEdit1Change(Sender: TObject);
begin
try
if
SpinEdit1
.
Value>
2
then
StringGrid1
.
RowCount:=SpinEdit1
.
Value+
1
;
except
end
;
draw;
end
;
procedure
TForm1
.
SpinEdit2Change(Sender: TObject);
begin
try
if
SpinEdit2
.
Value
>
2
then
StringGrid1
.
ColCount:=SpinEdit2
.
Value+
1
;
except
end
;
draw;
end
;
procedure
TForm1
.
Button2Click(Sender: TObject);
begin
Edit2
.
Text:=
''
;
With
StringGrid1
do
begin
for
j:=
1
to
RowCount-
1
do
for
ty:=
1
to
ColCount-
1
do
Cells[ty,j]:=
''
;
end
;
end
;
procedure
TForm1
.
FormCreate(Sender: TObject);
begin
draw;
end
;
end
.