I have to write a program to solve a quadratic equation and have different outputs based on the input (zero divide, no real roots, and the answer). I'm having problems right now making the program not find roots if there is an error condition, and I'm also get a repeating output when I use 'Q' to terminate the loop. Here is what I currently have I hope someone can help point out whats wrong with what I got.
I'm also get a repeating output when I use 'Q' to terminate the loop.
You may want to look into breaking out of the loop when you enter 'Q' into on of your variables.
I'm having problems right now making the program not find roots if there is an error condition
First I recommend you use braces {} with your condition statements, even if not actually required. Then find an indentation style you like and use it consistently. http://en.wikipedia.org/wiki/Indent_style Next since you are using an if/else chain if you place your calculations in the "non" error clause you will only do the calculations when you don't have an error.
I also think you need to restudy your "error" conditions. What happens in your program if discr is equal to zero?