In: Computer Science
write a member function in C++ , that takes two lists and return list that contain the merge of the two lists
in the returned list: first insert the first list and then the
second list
First of all, we are going to declare a function that will return a list of integers and will take two lists of integers as an input argument. Inside that, we will create an empty list. Then with the use of iterator, we will iterate each element of the list l1 and push it back of the empty list l until the list l1 is over. Similarly, we have to do the same with list l2 also.
Hence at the end, we will have our desired list that we will return.
Below is the screen-shot of the code with the output.
CODE :
OUTPUT: