0

i tried my writing my first script today :)

it is the solving the quadratic equation script and i found it in an older C++ book i'm working through

i made some edits to the script since i'm using Dev C++ as my compiler

(had this problem but fixed it http://www.physicsforums.com/showthread.php?t=238616)

here is my code

```
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
double root1, root2, a, b, c, root;
cout << "Enter the coefficients a, b, c: ";
cin >> a >> b >> c;
root = sqrt (b*b - 4.0*a*c);
root1 = .5*(root - b) / a;
root2 = -.5*(root - b) / a;
cout << "The solutions are: " << root1 << " and " << root2 << "\n";
return(0);
}
```

the script complies, and it runs asking for a,b, and c like it should

BUT when i enter 3 numbers and hit return the program closes. i've tried entering the numbers in a bunch of different ways but the program always closes without solving the quadratic equation of a,b,c.

please tell me what am i doing wrong?

thank you!!