View the step-by-step solution to:

# How can I fix my code to write the following without changing the concept.

How can I fix my code to write the following without changing the concept.

#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;

}

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

### Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

### -

Educational Resources
• ### -

Study Documents

Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

Browse Documents