0
How can i add 2 queues with operator overloading?
I've tried for hours, but I can't find any way to do it. The app just shows you 1 way to use it and then tells you to manipulate pointers. It's a bit dumb. That or I'm stupid. https://code.sololearn.com/cRc3soxtuM1C/?ref=app
5 Antworten
+ 3
Here's a start:-
Queue operator+(const Queue& obj)
{
Queue q3;
for(int i = 0; i < this->size; i++)
q3.add(this->queue[i]);
.........now you need to add the "obj" queue data.
0
I'm really thankful for the answers. It took me so long to accomplish nothing.
0
//your code goes here
Queue operator+(const Queue& obj)
{
Queue q3;
for(int i = 0; i < this->size; i++)
q3.add(this->queue[i]);
for (int i = 0; i <this -> size; i++)
q3.add(obj.queue[i]);
return q3;
}