
- •Interface
- •Implementation
- •Interface
- •Implementation
- •Interface
- •Implementation
- •Interface
- •Implementation
- •Interface
- •Implementation
- •Interface
- •Implementation
- •Interface
- •Implementation
- •Interface
- •Implementation
- •Interface
- •Implementation
- •Interface
- •Implementation
- •Interface
- •Implementation
- •Interface
- •Implementation
- •Interface
- •Implementation
- •Interface
- •Implementation
- •Interface
- •Implementation
Implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
C:char;
begin
c:=(edit1.Text[1]);
if (ord(C)>=48)and(ord(C)<58) then edit2.text:=('digit');
if (ord(C)>=65)and(ord(C)<91) then edit2.text:=('lat');
if (ord(C)>=97)and(ord(C)<123) then edit2.text:=('lat');
if (ord(C)>=192)and(ord(C)<256) then edit2.text:=('rus');
end;
end.
Калькулятор:
Memo1: TMemo;
Panel1: Разработать приложение:’Калькулятор!’
unit Unit1;
Interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
TPanel;
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
procedure Edit2KeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
Implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var result:real;
a,b:real;
begin
a:=strtofloat(edit1.Text);
b:=strtofloat(edit2.Text);
result:=a+b;
memo1.Lines.Add(edit1.Text+' + '+edit2.Text+' = '+floattostr(result));
edit1.Clear;
edit2.Clear;
end;
procedure TForm1.Button2Click(Sender: TObject);
var result:real;
a,b:real;
begin
a:=strtofloat(edit1.Text);
b:=strtofloat(edit2.Text);
result:=a-b;
memo1.Lines.Add(edit1.Text+' - '+edit2.Text+' = '+floattostr(result));
edit1.Clear;
edit2.Clear;
end;
procedure TForm1.Button3Click(Sender: TObject);
var result:real;
a,b:real;
begin
a:=strtofloat(edit1.Text);
b:=strtofloat(edit2.Text);
if b=0 then memo1.Lines.add(‘Уважаемый пользователь на 0 делить нельзя!’) else
begin
result:=a/b;
memo1.Lines.Add(edit1.Text+' / '+edit2.Text+' = '+floattostr(result));
end;
edit1.Clear;
edit2.Clear;
end;
procedure TForm1.Button4Click(Sender: TObject);
var result:real;
a,b:real;
begin
a:=strtofloat(edit1.Text);
b:=strtofloat(edit2.Text);
result:=a*b;
memo1.Lines.Add(edit1.Text+' * '+edit2.Text+' = '+floattostr(result));
edit1.Clear;
edit2.Clear;
end;
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
case key of
'0'..'9',',':; {Запрещается в поле Edit ввод любых символов , кроме цифр и запятых}
else key:=#0;end;
end;
procedure TForm1.Edit2KeyPress(Sender: TObject; var Key: Char);
begin
case key of
'0'..'9',',':; { Запрещается в поле Edit ввод любых символов , кроме цифр и запятых }
else key:=#0;end;
end;
end.
Вычислитель
Разработать приложение которое рассчитывает простые арифметические операций над числами
unit Вычислитель;
Interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm2 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Label1: TLabel;
Label2: TLabel;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
RadioButton3: TRadioButton;
RadioButton4: TRadioButton;
procedure RadioButton1Click(Sender: TObject);
procedure RadioButton2Click(Sender: TObject);
procedure RadioButton3Click(Sender: TObject);
procedure RadioButton4Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;