Write a program to copy one deka to another

So, I need to create a two-way queue, fill it and about initialize another, empty deck?

    1 answer 1

    If I were a teacher (I was 10 years old), then I would put the following meaning into this task:

    You need to show the ability to use the data structure "dek." You have two decks (for example, from STL), one filled with data and the other empty. You need to write a program that, through the functions of this deck (which allow you to access only the extreme elements) copies the data from one deck to the second. It is important that in the first deck, at the end of the algorithm, the data should remain!

    That is, the difficulty of the task is that you can refer only to either the first or the last element of the deck (add or delete them), but must somehow list its elements, copying them one by one to the second. This is the program you need to come up with. At the same time, I do not know whether it is possible to use a ready-made deck from STL or here you need to write your own.

    I hope I clarified the task? Of course, I will not do it.

    • one
      Thank you, I did not count on the decision :) - Vladislav Solopov