unit
Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Spin, Grids, ExtCtrls;
type
TForm1 =
class
(TForm)
SpinEdit1: TSpinEdit;
SpinEdit2: TSpinEdit;
SpinEdit3: TSpinEdit;
SpinEdit4: TSpinEdit;
SpinEdit5: TSpinEdit;
SpinEdit6: TSpinEdit;
Button1: TButton;
RadioGroup1: TRadioGroup;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
StringGrid1: TStringGrid;
Memo1: TMemo;
procedure
Button1Click(Sender: TObject);
procedure
RadioGroup1Click(Sender: TObject);
procedure
FormCreate(Sender: TObject);
private
public
end
;
var
Form1: TForm1;
fio:
array
[
1..10
]
of
string
;
ball:
array
[
1..10
]
of
integer
;
m,i:
word
;
implementation
{$R *.dfm}
procedure
TForm1
.
Button1Click(Sender: TObject);
var
j, imax:
integer
;
mball, max:
integer
;
mfio:
string
;
begin
m:=
6
;
Begin
for
i:=
1
to
m-
1
do
Begin
max:= ball[i];
imax:=i;
for
j:=i+
1
to
m
do
if
max< ball[j]
then
begin
max:= ball[j];
imax:=j;
end
;
mball:= ball[imax] ;
ball[imax]:= ball[i] ;
ball[i]:= mball;
mfio:=fio[i] ;
fio[i]:= fio[imax] ;
fio[imax]:= mfio;
end
;
end
;
end
;
procedure
TForm1
.
RadioGroup1Click(Sender: TObject);
var
k:
string
;
begin
StringGrid1
.
Visible:=
true
;
StringGrid1
.
RowCount:= m+
1
;
for
i:=
1
to
m
do
begin
StringGrid1
.
Cells[
0
,i]:=inttostr(i);
StringGrid1
.
Cells[
1
,i]:=fio[i];
StringGrid1
.
Cells[
2
,i]:=inttostr(ball[i]);
end
;
end
;
procedure
TForm1
.
FormCreate(Sender: TObject);
var
f1: TextFile;
Sport:
String
;
buf:
string
;
s:
string
;
begin
assignFile(f1,
'sport.txt'
);
reset(f1);
if
FileExists(
'sport.txt'
)
then
while
not
EOF(f1)
do
begin
Readln(F1, S);
memo1
.
Lines
.
Add(s) ;
end
;
CloseFile(f1);
end
;
end
.