vaibhava96 vaibhava96 - 1 year ago 110
C++ Question

looping through a deque using a recursive function in c++

I am trying to create a recursive function in c++ that takes in a deque of integers as a parameter, loops through each element one by one, and returns the deque. I have found a few previous posts on StackOverflow that do something similar, but I am unable to understand what is happening in their answers. I am relatively new to C++. While it may be far easier and more efficient to do this by using an iterative algorithm, I am required to use recursion (it's an assignment question). Help is greatly appreciated.

Answer Source

it should be something like this

deque <int> x;
void Calc (deque <int> d){
    if (d.empty()) return;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download