Queue Management - Part 2 - C++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Queue Management - Part 2 - C++

I've the solved the "Queue Management - Part 2" using the below code. Can anyone suggest any better approach? Queue operator +(Queue &secondQueue) { for(int i = 0; i < secondQueue.size; i++) this->add(secondQueue.queue[i]); return *this; }

20th Jun 2022, 5:13 PM
Anindya Dey
Anindya Dey - avatar
1 Answer
+ 1
Really is bo better approach. You could make your queue iterative by implementing a begin and end function and use a for each loop, but that can get quite complicated as you have to implement iterators.
4th Jul 2022, 5:22 PM
SimZooo
SimZooo - avatar