: .
:
- n - ;
- .
: .
:
- I ;
- k ;
- max ;
.4 .
. 4. .
:
Label1, Label2, Label3 ;
Edit1 Button1 ;
StGr1 Button2 ;
StGr2 ;
. 5 , .
.5. .
6.
. 6. .
unit Unit_3;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Label1: TLabel;
Button1: TButton;
StGr1: TStringGrid;
Label2: TLabel;
Button2: TButton;
Label3: TLabel;
StGr2: TStringGrid;
Button3: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
var N:integer;
procedure TForm1.Button1Click(Sender: TObject);
begin
Label2.Visible:=true;
Button2.Visible:=true;
StGr1.Visible:=true;
//
N:=StrToInt(Edit1.Text);
StGr1.ColCount:=N;
StGr2.ColCount:=N;
end;
procedure TForm1.Button2Click(Sender: TObject);
var i,k,max:integer;
C:array[1..20] of integer;
begin
Label3.Visible:=true;
StGr2.Visible:=true;
Button3.Visible:=true;
//
i:=1;
While i<=N do
begin
C[i]:=StrToInt(StGr1.Cells[i-1,0]); { }
i:=i+1;
end;
//
i:=1;
max:=C[1];
k:=1;
repeat
if max<C[i] then
begin
max:=C[i];
k:=i;
end;
i:=i+1;
until i>N;
//
C[k]:=C[1];
C[1]:=max;
//
for i:=1 to N do
StGr2.Cells[i-1,0]:=Inttostr(C[i]);
end;
procedure TForm1.Button3Click(Sender: TObject);
var i:integer;
begin
for i:=1 to n do
begin
StGr1.Cells[i-1,0]:='';
StGr2.Cells[i-1,0]:='';
end;
Edit1.Clear;
Label2.Visible:=false;
Button2.Visible:=false;
StGr1.Visible:=false;
Label3.Visible:=false;
StGr2.Visible:=false;
Button3.Visible:=false;
|
|
Edit1.SetFocus;
end;
end.
1. .
2. .
3. .
4. Delphi .
5. .
6. .
7. .
8. .
9. .
10. .
1. ?
2. :
X,Y:Real;
Y:=0;
For X:= 1.2 To 4.2 Do
Y:= Y + Cos(X);
I, N, S: Integer;
N:=25;
For I:= 1 To Sqrt (N) Do
S:=S * I;
For I:= 1 To 10 Do
I:=I + 2;
3. F :
F, K, I:Integer;
F:= 0; K:=1;
For I:=2 To K Do
F:=F + 1;
F:=0; I:=1;
Repeat
I:= I+1;
F:= F+I;
Until <=3;
F:=0; I:=1;
While I <=3 Do
Begin
F:=F +I;
I:=I+1
End;
4. ?
K, I:Integer;
For I:=1 To K+2 Do
K:= K+1;
5. ?
Var B: array [2, 7] of real;
Type Mas1 = array [1..8] of integer;
Var A1, A2:Mas1;
Var C: array [-2..7] of integer;
Var B: array ['B'.. 'F'] of integer;
6. :
Var : array ['a'.. 'p'] of real;