Advertisement
Guest User

Untitled

a guest
Apr 21st, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.88 KB | None | 0 0
  1. procedure TMainForm.btnMergeClick(Sender: TObject);
  2. begin
  3.    if not CheckIfNonDescendingAndCorrectSG(sgA) then
  4.       MessageBox(0, PChar('List A must be NONdecreasing'), PChar('Warning!'),
  5.         MB_ICONERROR)
  6.    else if not CheckIfNonDescendingAndCorrectSG(sgB) then
  7.       MessageBox(0, PChar('List B must be NONdecreasing'), PChar('Warning!'),
  8.         MB_ICONERROR)
  9.    else
  10.    begin
  11.       ListA := TList.Create;
  12.       ListB := TList.Create;
  13.       ListC := TList.Create;
  14.       try
  15.          ListA.AddFromSG(sgA);
  16.          ListB.AddFromSG(sgB);
  17.       except
  18.          MessageBox(0, PChar('List shouldn''t contain empty fields.'),
  19.            PChar('Warning!'), MB_ICONERROR);
  20.          Exit;
  21.       end;
  22.       ListC := MergeNonDescendingLists(ListA, ListB);
  23.       ListC.Show(sgC);
  24.       ShowOutputElements;
  25.       ListA.Destroy;
  26.       ListB.Destroy;
  27.       ListC.Destroy;
  28.    end;
  29. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement