unit
Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 =
class
(TForm)
ComboBox1: TComboBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Memo1: TMemo;
Button1: TButton;
procedure
FormActivate(Sender: TObject);
procedure
ComboBox1KeyPress(Sender: TObject;
var
Key:
Char
);
procedure
ComboBox1Click(Sender: TObject);
procedure
FormCreate(Sender: TObject);
procedure
Button1Click(Sender: TObject);
private
public
end
;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure
TForm1
.
FormActivate(Sender: TObject);
begin
ComboBox1
.
SetFocus;
end
;
procedure
TForm1
.
FormCreate(Sender: TObject);
begin
end
;
procedure
TForm1
.
ComboBox1KeyPress(Sender: TObject;
var
Key:
Char
);
begin
if
key=#
13
then
begin
ComboBox1
.
Items
.
Add(ComboBox1
.
Text);
ComboBox1
.
Text:=
' '
;
end
;
end
;
procedure
TForm1
.
Button1Click(Sender: TObject);
begin
var
CPos:
word
;
SPos:
word
;
begin
SPos :=
1
;
with
Edit1
do
for
CPos :=
1
to
Length(Text)
do
if
Text[CPos] <> Text[CPos+
1
]
then
begin
if
((CPos-SPos+
1
)
mod
2
) =
0
then
ListBox1
.
Items
.
Add(Copy(Text, SPos, CPos-SPos+
1
));
SPos := CPos+
1
;
end
;
procedure
TForm1
.
ComboBox1Click(Sender: TObject);
var
st:
string
;
n,i,nst,ind:
integer
; a:
array
[
1..3
]
of
char
; b:
boolean
; s:
real
;
begin
n:=
0
;
ind:=
0
;
nst:= ComboBox1
.
ItemIndex;
st:= ComboBox1
.
Items[nst];
for
i:=
1
to
Length(st)
do
begin
n:=length(
'st'
);
end
;
If
(n
MOD
2
) =
0
then
memo1
.
Lines
.
add(
'Четное'
)
else
memo1
.
Lines
.
add(
'Нечетное'
);
end
;
end
.