Can anyone help me figure out what's wrong?I can't get the program to compile. I'm using QT and you can just ignore the QT statements (cin, cout).
Code:
#include <QtCore/QCoreApplication>
#include <cmath>
using namespace std;
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
int quit;
int continueflag;
double aa, bb, cc;
double delta;
double x1, x2;
cout << "Solving quadratic equation" << endl;
while (!quit) {
cout << "What is the value of a? " << endl;
cin >> aa;
cout << "What is the value of b? " << endl;
cin >> bb;
cout << "What is the value of c? " << endl;
cin >> cc;
delta = bb * bb - 4.0 * aa * cc;
if ((delta >= 0) && (aa != 0.0)) {
x1 = (-bb + sqrt(delta)/(2.0 * aa);
x2 = (-bb - sqrt(delta)/(2.0 * aa);
cout << "Equation solution: x1 = " << x1 << " x2 = " << x2 << endl;
}
else
cout << "Equation is unsolvable." << endl;
cout << "[ENTER] to try again, [Q] to quit." << endl;
cin >> continueflag ;
if (continueflag == "Q") quit = 1;
return a.exec();
}
}