Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- procedure TMainForm.btnMergeClick(Sender: TObject);
- begin
- if not CheckIfNonDescendingAndCorrectSG(sgA) then
- MessageBox(0, PChar('List A must be NONdecreasing'), PChar('Warning!'),
- MB_ICONERROR)
- else if not CheckIfNonDescendingAndCorrectSG(sgB) then
- MessageBox(0, PChar('List B must be NONdecreasing'), PChar('Warning!'),
- MB_ICONERROR)
- else
- begin
- ListA := TList.Create;
- ListB := TList.Create;
- ListC := TList.Create;
- try
- ListA.AddFromSG(sgA);
- ListB.AddFromSG(sgB);
- except
- MessageBox(0, PChar('List shouldn''t contain empty fields.'),
- PChar('Warning!'), MB_ICONERROR);
- Exit;
- end;
- ListC := MergeNonDescendingLists(ListA, ListB);
- ListC.Show(sgC);
- ShowOutputElements;
- ListA.Destroy;
- ListB.Destroy;
- ListC.Destroy;
- end;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement