Need Help

0 Christopher Recken · September 15, 2015
I just started c++ two days ago and I'm creating my own basic calculator but it says "Unhandled Exception" .

Can someone help me ? whats wrong with my code?

>>sorry for my bad English <<<


Post a Reply


Oldest  Newest  Rating
0 ishwiin doe · September 16, 2015
c++ does not allow you divide by 0.
change the line to
int divide;
from what i have seen it should not harm your program
0 Alper Akgoz · September 16, 2015
You are doing the operations before you assign any value to a,b, v1 and v2. 
0 Arend Peter Castelein · September 18, 2015
Move the first 4 lines of cin/cout code to the beginning of your main function.

Your program is starting at the top where you've created v1,v2,select, a and b.
When you declare floats (as you're doing with v1 and v2) they get a default value of zero.
Since you set b to equal v2 (i.e. 0), it results in a divide by 0 error when you try to compute divide.
  • 1



Used in many types of software including music players, video games, and many large scale applications.

Bucky Roberts Administrator