Here is my first Code Snippet contribution: a C++ sub-routine that computes the roots of a quadratic equation.
Notes:
- This sub-routine checks if a = 0.
- IF a = 0, then the equation is actually not a quadratic equation; it is a linear equation with one--if any--root.
- IF the user misses the output statement alerting the user to this fact, the second root has been explicitly assigend a NaN value so that the result is not mistaken for a number.