###Common beginner mistakes
Stop doing this:
using namespace std;
See Why is "using namespace std;" considered bad practice?
###Namespaces All your functions seem to have the prefix rdo_
bool rdo_ws(char c)
char rdo_expr_item_type(char c)
string rdo_opp_to_string(char opp)
bool rdo_is_num(string is_num)
void rdo_count_opp(bool to_count_or_not)
string rdo_eval(string expr)
This is old school C classic from before the time of namespaces. Easier to not use the prefix and put all your functions into a namespace called rdo.
###Maintainability
You have a seriously long function rdo_eval() (344 lines). Functions that long are considered bad style as they are really hard to read and maintain. A good rule of thumb is that a function should be no longer than your screen (ie you want to be able to read the whole function in a single glance without scrolling), so 40-80 lines.
###Variables Declare variables where you are going to use them, not at the top of the function. It makes it easy to see usage if you can look close to where you are using the variable to see its definition. This becomes a lot more important when you start using objects with constructors (as the constructors can call arbitrator code).
- 97.7k
- 5
- 126
- 341