Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit unit4;
- interface
- uses unit1, unit2;
- type
- tarraycirclecontainer=class
- private
- count:integer;
- circs : array [1..100] of Tcircle;
- public
- constructor create;
- function getcount:integer;
- function add(acirc:tcircle):boolean;
- function delete(ai:integer):tcircle;
- function search(arad:integer; var nom:integer):tcircle;
- procedure showall;
- procedure movall(dx,dy:integer);
- end;
- implementation
- constructor tarraycirclecontainer.create;
- var
- i:integer;
- begin
- for i := 1 to 100 do circs[i]:=nil;
- count:=0;
- end;
- function tarraycirclecontainer.add(acirc:tcircle):boolean;
- begin
- result:=false;
- if (count<100) then
- begin
- count:=count+1;
- circs[count]:=acirc;
- result:=true;
- end;
- end;
- function tarraycirclecontainer.delete(ai:integer):tcircle;
- begin
- result:=nil;
- if (count>0) and (ai<=count) then
- begin
- result:= circs[ai];
- count:=count-1;
- end;
- end;
- function tarraycirclecontainer.search(arad:integer; var nom:integer):tcircle;
- var i:integer;
- begin
- result:=nil;
- if (count>0) then
- for i:= 1 to count do
- if (circs[i].getr=arad) then
- begin
- nom:=i;
- result:=circs[i];
- break
- end;
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement