0
How can I getting the sum of two Queues in C++?
I'm trying to solve a lesson that asks to obtein the sum of two queues in C++ unsing operators overloading, but without success. Can anyone help me?
3 odpowiedzi
+ 1
The lesson/ project I assume you are referring to defines the sum of two queues as "a new queue, where the elements of the first queue come first, followed by the second queue's elements".
Therefore, what you have to do is to construct a new queue, add the elements of the first queue, add the elements of the second queue, (handle the size if necessary) and return it. You already have member functions for most of this.
If you need help with the code, please copy it to a playground project and link that here, otherwise we have no way of knowing what might be wrong.
0
Yes, that's the lesson. I was trying to do like exemples were made. But it always returns error. I'll try the way you told me.
0
Thanks 👍