Advertisement
dxvmxnd

Untitled

Mar 13th, 2024
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. function CheckForComputersAmount(Computers : MainUnit.TArray) : Integer;
  2. Var
  3. I : Integer;
  4. Num : Integer;
  5. begin
  6. Num := 0;
  7. For I := 0 To High(Computers) Do
  8. Begin
  9. If(Computers[I].Guarantee <= 2) Then
  10. Inc(Num);
  11. End;
  12.  
  13. CheckForComputersAmount := Num;
  14. end;
  15.  
  16. function FindDoneComputers(Amount : Integer; Computers : MainUnit.TArray) : MainUnit.TArray;
  17. var
  18. DoneComputers : MainUnit.TArray;
  19. I, J : Integer;
  20. Temp : MainUnit.TObjects;
  21. begin
  22. SetLength(DoneComputers, Amount);
  23. J := 0;
  24.  
  25. For I := 0 To High(Computers) Do
  26. Begin
  27. If(Computers[I].Guarantee <= 2) Then
  28. Begin
  29. DoneComputers[J] := Computers[I];
  30. Inc(J);
  31. End;
  32. End;
  33.  
  34. For I := 0 To High(DoneComputers) Do
  35. Begin
  36. For J := 0 To (High(DoneComputers) - I - 1) Do
  37. Begin
  38. If(DoneComputers[J].Price < DoneComputers[J+1].Price) Then
  39. Begin
  40. Temp := DoneComputers[J];
  41. DoneComputers[J] := DoneComputers[J+1];
  42. DoneComputers[J+1] := Temp;
  43. End;
  44. End;
  45. End;
  46.  
  47. FindDoneComputers := DoneComputers;
  48.  
  49. end;
  50.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement