This code is just a function in a bigger code, but I'm having a problem with the break. I'm not sure I'm doing it right, but basically if the factors are zero, then the program should say the equation can't be factored. It does that, but then continues through the rest of the program.
void display(int a, int c, int g, int f1, int f2)
{
while(f1==0&&f2==0)
{
cout << "This equation does not factor.";
break;
}
cout << "The equation is now (" << a << "x^2+" << f1 << "x)+(" << f2 << "x+" << c << ")" << endl;
int g1=gcd(a, f1);
int g2=gcd(f2, c);
a=a/g1, f1=f1/g1, f2=f2/g2, c=c/g2;
cout << "The equation is now " << g1 << "x(" << a << "x+" << f1 << ")+" << g2 << "(" << f2 << "x+" << c << ")=(" << a << "x+" << f1 << ")(" << g1 << "x+" << g2 << ")" << endl;
cout << "The factored equation is " << g << "(" << a << "x+" << f1 << ")(" << g1 << "x+" << g2 << ")" << endl;
}