Well i'm trying to do a calculator program and i'm using recursion to find brackets ( called BracketSearch() ), after finding a "(" i start copying all that is after that in another vector V2 until i find it's corresponding ")".
eg if originally it was
then in V2 there will be 3-4*(5/6).
It will recusively pass V2 into BracketSearch() (it will copy the values or operators to V2 and it will also be deleting them from the original vector ) until there are no brackets at all, if there are no brackets at all it will do the calculation and return the value to the previous recursion (return it in the place of the values deleted).
In our example after breaking it down till there are no brackets, there will be only 5/6 left. so it will calculate 5/6 which will give me a double , lets called it num1. So it will return num1 back to it's previous recursion and replace it in the place of (5/6) which will give 3-4*num1.
Then it will calculate 3-4*num1 which will give num2 which in turn will be returned back to it's previous recursion. I want it to keep climbing back to the top till i only have a double as value. Well the problem is that i've been able to devise an algo to break it down till it has no brackets but i don't know how to write a so that it keeps climbing back to the top. How should i return it so that it climbs back to the top??? BracketSearch() must return a double.
Sorry for my poor english i hope you understood what i wanted to say :cheesy: