second degree aquation

#include <cstdlib>
#include <iostream>
#include <cmath>

using namespace std;

int main()
{
int a,b,c,delta,x1,x2;
cout<<"enter a,b and c.\n";
cin>>a>>b>>c;
delta=pow(b,2.0)-4*a*c;
x1=(-b+sqrt(delta))/2*a;
x2=(-b-sqrt(delta))/2*a;
if (delta<0)
{
cout<<"no real root.\n";
}
else if (delta>=0)
{
cout<<" x1 is "<<x1<<" x2 is "<<x2<<".\n";
}



system("PAUSE");
return EXIT_SUCCESS;
}
Topic archived. No new replies allowed.