Help with loop

I am trying to write a while loop on a calculator in c++. its my first real program in c++. when i use the calculator, it works and loops, but when i type exit(which sets x to 1), the calculator keeps going. Here is the code: http://pastebin.com/DaZaRNjh
1
2
3
if(oper == "exit"){
        int x = 12;
        }


x is a local variable that goes out of scope immediately.

Should be:
1
2
3
if(oper == "exit"){
        x = 12;
        }


By the way, main returns int, not void.
Last edited on
wow, i just saw that and was going to delete the post, i cant believe you guys
reply so fast, its been like 3 minutes. Thank you!
should i delete the thread, or keep it unless someone has the same problem?
Last edited on
No reason to delete the thread, just mark it as solved.
Topic archived. No new replies allowed.