programming a Quadratic Equation Solver

Pages: 12
As advice, you can streamline the calculation of det to
sqrt(b*b-4*a*c);
I'm pretty sure operator precedence acknowledges bedmas so you can skip the variable d this way. After all, you pass in the number of roots so it doesn't serve much purpose except as an intermediary.
I personally also advise against system("cls"). I used to find the novelty of cls quite cool but it's not really worth incorporating IMO. (If I was in need of cls, I would honestly switch to curses, because chances are I'd need some more of the stuff in curses too.) System calls should generally be avoided so this cls call isn't great.
You can also streamline the actual equations for your roots to
(-b+det)/2a
I personally think this looks better, but it's not too much difference afaik.
Those are the only real suggestions I have, and none of them are really groundbreaking stuff.
Topic archived. No new replies allowed.
Pages: 12