Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
1234.docx
Скачиваний:
0
Добавлен:
01.05.2025
Размер:
21.21 Кб
Скачать

Implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);

begin

a:=strtoint(edit1.text);

b:=strtoint(edit2.text);

k:=strtoint(edit3.text);

s:=0;n:=0;

Memo1.Clear;

Label4.caption:='';

while abs(s)<k do

begin

r:=randomRange(a,b);

s:=s+r;

n:=n+1;

memo1.lines.Add(inttostr(r));

end;

label4.caption:='Сумма слагаемых = '+inttostr(s)+',их количество= '+inttostr(n);

end;

procedure TForm1.Button2Click(Sender: TObject);

begin

Form1.close;

end;

end.

3.1Лаба

unit Unit2;

Interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, StdCtrls;

type

TForm1 = class(TForm)

Memo1: TMemo;

Label1: TLabel;

Label2: TLabel;

Button1: TButton;

Edit1: TEdit;

Label3: TLabel;

Edit2: TEdit;

Label4: TLabel;

Edit3: TEdit;

Label5: TLabel;

Label6: TLabel;

Edit4: TEdit;

Label7: TLabel;

Edit5: TEdit;

Button2: TButton;

procedure Button1Click(Sender: TObject);

procedure Button2Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form1: TForm1;a,b,h,ot,d,x,y:real;

Implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);

begin

Memo1.Clear;

a:=strtofloat(edit1.Text);

b:=strtofloat(edit2.Text);

h:=strtofloat(edit3.Text);

ot:=strtofloat(edit4.Text);

d:=strtofloat(edit5.Text);

x:=ot;

while (ot<=x)and(x<=d) do begin

if x=0 then

memo1.Lines.add('0 Нет решения');

if (x<1.4) and (x<>0) then begin

y:=(a+b)/(exp(x)-cos(x));

memo1.Lines.Add(floattostr(x)+' '+floattostr(y));

end;

if (x=1.4) then begin

y:=(a+b)*(x+1);

memo1.Lines.Add(floattostr(x)+' '+floattostr(y));

end;

if x>1.4 then begin

y:=exp(x)+sin(x);

memo1.Lines.Add(floattostr(x)+' '+floattostr(y));

end;

x:=x+h;

end;

end;

procedure TForm1.Button2Click(Sender: TObject);

begin

Form1.Close;

end;

end.

4лаба

unit Unit1;

Interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, StdCtrls, ExtCtrls;

type

TForm1 = class(TForm)

Label1: TLabel;

Label2: TLabel;

Button1: TButton;

GroupBox2: TGroupBox;

CheckBox1: TCheckBox;

CheckBox2: TCheckBox;

ListBox1: TListBox;

ComboBox1: TComboBox;

RadioGroup1: TRadioGroup;

Button2: TButton;

procedure Button1Click(Sender: TObject);

procedure Button2Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form1: TForm1;

Implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);

begin

case ComboBox1.itemindex of

0:case RadioGroup1.Itemindex of

0:begin

ListBox1.clear;

ListBox1.items.add('Россия');

ListBox1.Items.Add('Эстония');

ListBox1.Items.Add('Латвия');

checkbox1.checked:=false;

checkbox2.checked:=false;

end;

1:begin

ListBox1.clear;

ListBox1.items.add('Чехия');

ListBox1.Items.Add('Польша');

ListBox1.Items.Add('Литва');

checkbox1.checked:=false;

checkbox2.checked:=true;

end;

2:begin

ListBox1.clear;

ListBox1.items.add('Украина');

ListBox1.Items.Add('Тринидад и тобаго');

ListBox1.Items.Add('Испания');

checkbox1.checked:=true;

checkbox2.checked:=false;

end;

3:begin

ListBox1.clear;

ListBox1.items.add('Англия');

ListBox1.Items.Add('Франция');

ListBox1.Items.Add('Италия');

checkbox1.checked:=true;

checkbox2.checked:=true;

end;

end;

1:case RadioGroup1.itemindex of

0:begin

ListBox1.clear;

ListBox1.items.add('Китай');

ListBox1.Items.Add('Южная Корея');

ListBox1.Items.Add('Северная Корея');

checkbox1.checked:=false;

checkbox2.checked:=false;

end;

1:begin

ListBox1.clear;

ListBox1.items.add('Япония');

ListBox1.Items.Add('Индокитай');

ListBox1.Items.Add('Вьетнам');

checkbox1.checked:=false;

checkbox2.checked:=true;

end;

2:begin

ListBox1.clear;

ListBox1.items.add('Сингапур');

ListBox1.Items.Add('Казахстан');

ListBox1.Items.Add('Туркменистан');

checkbox1.checked:=true;

checkbox2.checked:=false;

end;

3:begin

ListBox1.clear;

ListBox1.items.add('Тибет');

ListBox1.Items.Add('Сеул');

ListBox1.Items.Add('Таджикистан');

checkbox1.checked:=true;

checkbox2.checked:=true;

end;

end;

2:case RadioGroup1.itemindex of

0:begin

ListBox1.clear;

ListBox1.items.add('Тунис');

ListBox1.Items.Add('Канада');

ListBox1.Items.Add('Катар');

checkbox1.checked:=false;

checkbox2.checked:=false;

end;

1:begin

ListBox1.clear;

ListBox1.items.add('США');

ListBox1.Items.Add('Мадагаскар');

ListBox1.Items.Add('Бразилия');

checkbox1.checked:=false;

checkbox2.checked:=true;

end;

2:begin

ListBox1.clear;

ListBox1.items.add('Иран');

ListBox1.Items.Add('Ирак');

ListBox1.Items.Add('Марокко');

checkbox1.checked:=true;

checkbox2.checked:=false;

end;

3:begin

ListBox1.clear;

ListBox1.items.add('Египет');

ListBox1.Items.Add('Куба');

ListBox1.Items.Add('Алжир');

checkbox1.checked:=true;

checkbox2.checked:=true;

end;

end;

end;

end;

procedure TForm1.Button2Click(Sender: TObject);

begin

Form1.close;

end;

end.

5лаба

unit Unit1;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, ExtCtrls, StdCtrls;

type

TForm1 = class(TForm)

Button1: TButton;

procedure FormClick(Sender: TObject);

procedure Button1Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form1: TForm1;koord:TPoint;x1,y1:integer;

implementation

{$R *.dfm}

procedure TForm1.FormClick(Sender: TObject);

begin

getcursorpos(koord);

x1:=koord.X;

y1:=koord.y;

with form1.Canvas do begin

Rectangle(x1-196,y1-143,x1,y1+50);

moveto(x1-250,y1-50);

lineto(x1-100,y1-200);

lineto(x1+50,y1-50);

lineto(x1-100,y1+100);

lineto(x1-250,y1-50);

end;

end;

procedure TForm1.Button1Click(Sender: TObject);

begin

Form1.Close;

end;

end.

5.1лаба

unit Unit2;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, ExtCtrls, StdCtrls;

type

TForm1 = class(TForm)

Timer1: TTimer;

Button1: TButton;

procedure FormActivate(Sender: TObject);

procedure Timer1Timer(Sender: TObject);

procedure Button1Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form1: TForm1;x,y:integer;

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]