Предмет:
Тип роботи:
Звіт з практики
К-сть сторінок:
46
Мова:
Українська
justify;"> Shape2.Left:=x0;
end;
procedure TForm1.Shape2MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var x0,y0:integer;
begin randomize;
Shape1.Top:=random(Form1.clientheight-Shape1.height);
Shape1.Left:=random(Form1.clientwidth-Shape1.width);
y0:=random(Form1.clientheight-Shape2.height);
x0:=random(Form1.clientwidth-Shape2.width);
while not(((Shape1.left+Shape1.Width<x0)or(Shape1.left-Shape2.Width>x0))and((Shape1.Top+Shape1.Height<y0)or(Shape1.Top-Shape2.Height>y0))) do
begin y0:=random(Form1.clientheight-Shape2.height);
x0:=random(Form1.clientwidth-Shape2.width);end;
Shape2.Top:=y0;
Shape2.Left:=x0;
end;
end.
15. Програма, яка реалізовує ходи шахових фігур.
program Project1;
{$APPTYPE CONSOLE}
uses
SysUtils,
unit1 in 'unit1.pas';
var figures:array[1..4] of Tfigure;
x,y,i:integer; desk:d; s:string; p:boolean;
begin
writeoutdesk(desk);
s:='';
write('enter x=');
readln(x);
write('enter y=');
readln(y);
while (s<>'white')and(s<>'black') do begin writeln('enter color ');readln(s);end;
if s='white' then p:=true else p:=false;
figures[1]:=Tknight.create(x,y,p,desk);
// figures[1].writeout(desk);
s:='';
write('enter x=');
readln(x);
write('enter y=');
readln(y);
while (s<>'white')and(s<>'black') do begin write('enter color '); readln(s);end;
if s='white' then p:=true else p:=false;
figures[2]:=Tbishop.create(x,y,p,desk);
// figures[2].writeout(desk);
s:='';
write('enter x=');
readln(x);
write('enter y=');
readln(y);
while (s<>'white')and(s<>'black') do begin write('enter color ');readln(s);end;
if s='white' then p:=true else p:=false;
figures[3]:=Trook.create(x,y,p,desk);
// figures[3].writeout(desk);
s:='';
write('enter x=');
readln(x);
write('enter y=');
readln(y);
while (s<>'white')and(s<>'black') do begin write('enter color ');readln(s);end;
if s='white' then p:=true else p:=false;
figures[4]:=Tpawn.create(x,y,p,desk);
// figures[4].writeout(desk);
writeoutdesk(desk);
for I := 1 to 4 do
if figures[i].live then
begin
writeln('move ',figures[i].name,' to x,y');
write('x='); readln(x);
write('y='); readln(y);
figures[i].movetoplace(x,y,desk);
end;
// figures[1].writeout(desk);
writeoutdesk(desk);
readln;
end.
16.Калькулятор
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type symbol=set of '0'..'9';
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Button6: TButton;
Button7: TButton;
Button8: TButton;
Button9: TButton;
Button10: TButton;
Button11: TButton;
Button12: TButton;
Button13: TButton;
Button14: TButton;
Button15: TButton;
Button16: TButton;
Button17: TButton;
Button18: TButton;
Button19: TButton;
Button20: TButton;
Button21: TButton;
procedure Button17Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormActivate(Sender: TObject);
procedure Button21Click(Sender: TObject);
procedure Button15Click(Sender: TObject);
procedure Button19Click(Sender: TObject);
procedure Button18Click(Sender: TObject);
procedure Button20Click(Sender: TObject);
procedure Button16Click(Sender: TObject);
procedure Button14Click(Sender: TObject);
procedure Button13Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button12Click(Sender: TObject);
procedure Button11Click(Sender: TObject);
procedure Button10Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button4Click(Sender: