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

26th Mar 2022, 10:22 PM
Chironex
Chironex - avatar
3 odpowiedzi
+ 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.
26th Mar 2022, 10:40 PM
rodwynnejones
rodwynnejones - avatar
0
I'm really thankful for the answers. It took me so long to accomplish nothing.
26th Mar 2022, 10:43 PM
Chironex
Chironex - avatar
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; }
24th Feb 2024, 11:19 AM
Saurabh Sharma
Saurabh Sharma - avatar