Advertisement
Guest User

Untitled

a guest
May 22nd, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. const
  2. Garaj_Slot = 100;
  3.  
  4. type
  5. TKompaniya = class
  6. private
  7. Mas: array[1..Garaj_Slot] of TGaraji;
  8. Mas_First, Mas_Last: integer;
  9. Mas_Count: integer;
  10. public
  11. constructor Create();
  12.  
  13. function Add_Garaj(aGaraj_Info: TGaraji): boolean;
  14. function Del_Garaj: boolean;
  15. end;
  16. implementation
  17.  
  18. constructor TKompaniya.Create();
  19. begin
  20. Mas_First := 1;
  21. Mas_Last := 1;
  22. Mas_Count := 0;
  23. end;
  24.  
  25. function TKompaniya.Add_Garaj(aGaraj_Info: TGaraji): boolean;
  26. begin
  27. Result := False;
  28.  
  29. if Mas_Count <> Garaj_Slot then
  30. begin
  31. Mas[Mas_Last] := aGaraj_Info;
  32. Mas_Last := Mas_Last + 1;
  33. Mas_Count := Mas_Count + 1;
  34. if Mas_Last > Garaj_Slot then
  35. Mas_Last := 1;
  36. Result := True;
  37. end;
  38. end;
  39.  
  40. function TKompaniya.Del_Garaj: boolean;
  41. begin
  42. Result := False;
  43. if Mas_Count <> 0 then
  44. begin
  45. Mas[Mas_First] := nil;
  46. Mas_First := Mas_First + 1;
  47. if Mas_First > Garaj_Slot then
  48. Mas_First := 1;
  49. Mas_Count := Mas_Count - 1;
  50. Result := True;
  51. end;
  52. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement