I have a very complex code to transform from recursion to iteration. I don't know how to do that with this kind of code :
read(std::queue<int>& rules, std::queue<double>& data)
{
int r = rules.top();
rules.pop();
switch(r)
{
case 1:
{
double a = data.front(); data.pop();
read(rules, data);
double b = data.front(); data.pop();
read(rules, data);
double c = a + b;
data.push(c);
}
break;
case 2:
{
read(rules, data);
data.pop();
}
break;
case 3:
{
data.push(0.0);
}
}
}
I have no idea how to start in this kind of situation...