an easier way to find ou if a number is imaginary is to find out if the equation under the radical is negative. If so then output an i after the output of the answer. If not then just evaluate it regullarly. A little bit of the code would look like this:

Code:

float determinant;
float root;
determinant = b*b - (4*a*c);
if(determinant < 0)
{
determinant = determinant * -1;
root1 = (b + Sqrt(determinant) )/ 2;
root 2 = (b - Sqrt(determinant) )/ 2;
cout << "The answers are: " << root1 << "i, " << root2 << "i." << endl;
}
else
{
root1 = (b + Sqrt(determinant) )/ 2;
root 2 = (b - Sqrt(determinant) )/ 2;
cout << "The answers are: " << root1 << ", " << root2 << endl;
}

There you go. Hope it helps you out.

-Bill