Ok, that takes you through the solution of both the real and complex cases (constants a to e can be real/complex). [The real case is just a quick optimization of the complex case].
If you have coded up quadratic and cubic equations before and understand how the solvers work then you will have no problems. If you haven't done them before, ensure:
(i) You understand how they work [remember that your solver will have to do that in the case that constant a is zero.]
(ii) you have written and tested each of them
(iiI) You understand the special cases of the simpler equations
Your quadratic solver will use the lower level solvers for many of the special cases, e.g.
for the case that the depressed function has a zero x term. You cannot bluntly ignore the zero coefficient terms and just pretend that you want to solve it with the general form. It will give you divide by zero errors, or horrific numerical errors if you try to set zero to a very small number.
The quartic equation has a lot of alternate cases, it becomes an ugly mess of "if statements", in C++, no matter how it is coded up, so it is a trick exercise, you are really going to need a number of test cases to ensure that your code works for most quartic equations. [Remember you can
generate test cases by expanding (x-a)(x-b)(x-c)(x-d)=0 and if a and b are complex and a*==b, the
you can test real coefficients with complex roots]
The quadratic equation (ax^2 + bx+c=0) is coded up by most beginners, in such a way that they get horrible rounding errors in the root finding, the quartic equations is similar in that rounding errors are easy to build into the code. It will easily pay you to put a Newton-Raphson step at the end after your find your root, to further resolve them. This will do two things: it will give you an error term on each of your roots and it will suppress much of the rounding error that builds up in the solution.