Показать сообщение отдельно
  #2  
Старый 16.01.2012, 22:03
Kingcss Kingcss вне форума
Начинающий
 
Регистрация: 20.12.2010
Адрес: Иваново
Сообщения: 100
Версия Delphi: Delphi 7
Репутация: 519
По умолчанию

Господи, первый класс:
PHP код:
procedure TForm1.Button1Click(SenderTObject);
var
a:integer;
begin
a
:=strtoint(Edit1.Text);
if 
a>0 then
Label1
.Caption:='+'
else if a=0 then
Label1
.Caption:='0'
else Label1.Caption:='-';
end;

procedure TForm1.Button2Click(SenderTObject);
begin
Label2
.Caption:=inttostr(ABS(strtoint(Edit1.Text)));
end;

procedure TForm1.Button3Click(SenderTObject);
var
prostoe:boolean;
i:integer;
x:integer;
begin
prostoe
:=true;
x:=strtoint(Edit1.Text);
if 
x<2 then exit;
for 
i:=2 to x div 2 do
if 
x mod i=0 then
begin
prostoe
:=false;
break;
end;
if 
prostoe then Label3.Caption:='Простое число'
else Label3.Caption:='НЕпростое число';
end
Ответить с цитированием