Advertisement
Guest User

Untitled

a guest
Feb 19th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.19 KB | None | 0 0
  1. unit unit4;
  2.  
  3. interface
  4. uses unit1, unit2;
  5. type
  6. tarraycirclecontainer=class
  7. private
  8. count:integer;
  9. circs : array [1..100] of Tcircle;
  10. public
  11. constructor create;
  12. function getcount:integer;
  13. function add(acirc:tcircle):boolean;
  14. function delete(ai:integer):tcircle;
  15. function search(arad:integer; var nom:integer):tcircle;
  16. procedure showall;
  17. procedure movall(dx,dy:integer);
  18. end;
  19. implementation
  20. constructor tarraycirclecontainer.create;
  21. var
  22.   i:integer;
  23. begin
  24.   for i := 1 to 100 do circs[i]:=nil;
  25.     count:=0;
  26. end;
  27.  
  28. function tarraycirclecontainer.add(acirc:tcircle):boolean;
  29. begin
  30.   result:=false;
  31.   if (count<100) then
  32.     begin
  33.       count:=count+1;
  34.       circs[count]:=acirc;
  35.       result:=true;
  36.     end;
  37. end;
  38.  
  39. function tarraycirclecontainer.delete(ai:integer):tcircle;
  40. begin
  41.   result:=nil;
  42.   if (count>0) and (ai<=count) then
  43.   begin
  44.     result:= circs[ai];
  45.     count:=count-1;
  46.   end;
  47. end;
  48.  
  49. function tarraycirclecontainer.search(arad:integer; var nom:integer):tcircle;
  50. var i:integer;
  51. begin
  52.   result:=nil;
  53.   if (count>0) then
  54.   for i:= 1 to count do
  55.     if (circs[i].getr=arad) then
  56.     begin
  57.       nom:=i;
  58.       result:=circs[i];
  59.       break
  60.     end;
  61. end;
  62. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement