This is a discussion on Switch help plz within the C Programming forums, part of the General Programming Boards category; ghjgyj...
Last edited by joshua; 11-17-2005 at 09:48 PM.
A switch statement requires an integral type. For scanf, use "%lf" for a double.
7. It is easier to write an incorrect program than understand a correct one.
40. There are two ways to write error-free programs; only the third one works.*
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.
Sent from my iPadŽ