You have a few problems. One your case is a character and your switch is looking for a double (which should be an integer). Your second problem is you have no 0 case. You have a case for doing the calculation, then you have everything else. So if you fix problem one, yes the program will exit when you press 0, but it will also exit if you input 2 or 3.