Ok I use the following function but i get strange errors..
I get the following errors/warning..Code:double term(bool get) // multiply and divide { double left = prim(get); for (;;) switch (curr_tok) { case POWER : double y = prim(true); //error is here! power(y,left); break; case MUL : left *= prim(true); break; case DIV : if (double d = prim(true)) { left /= d; break; } return error("Divide by 0"); default : return left; } }
/Users/luigi/Documents/c++/Bjarne/Project Builder/Ch 6/ex18*/calc.cpp:122: crosses initialization of `double y'
/Users/luigi/Documents/c++/Bjarne/Project Builder/Ch 6/ex18*/calc.cpp:125: warning: jump to case label
case Div is about the same but I dont get any errors... why is that so?