How to fix my code to run the following ?

#include<iostream>

#include<cmath>

using namespace std;

int main ()

{

float a,b,x1a,x1b,x2a,x2b;

float newa,newb;

float tol = 1e-5;

x1a = (((a*a*a) - (3*a*b*b))-1);

x1b = ((3*(a*a*b))-(b*b*b));

x2a = ((3*(a*a))-(3*(b*b)));

x2b = (6*(a*b));

while ( sqrt (x1a*x1a+x1b*x1b) > tol) {

cout << "Initial guess (real and imag): ";

cin >> a >> b;

newa = a + ((x1a*x2a + x1b*x2b)/(x2a*x2a+x2b*x2b));

newb = b + ((x2a*x1b - x1a*x2b)/(x2a*x2a+x2b*x2b));

if ((a < 0) && (b == 0))

{

cout << "Initial guess z = " << newa << " converges to red root." << endl;

}

else if ((a < 0) && (b > 0))

{

cout << "Initial guess z = " << newa << "+" << newb << "j" << "converges to green root." << endl;

}

else if ((a>0) && (b>0))

{

cout << "Initial guess z = " << newa << "+" << newb << "j" << "converges to blue root." << endl;

}

else

{

cout << "ok done"<< endl;

}

}

return 0;

}

#### Top Answer

the fixed code #include<iostream> #include<cmath> using namespace std ; int main () { float a,b,x1a,x1b,x2a,x2b;... View the full answer