hi I need help with this program, I have to write an easy code for complex number thank you
if I put a=1, b=2. c=2 then I should get x=-1+j.1 and y=-1-j.1. I am an engineer so I use j instead of i.
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
float a=0.0;
float b=0.0;
float c=0.0;
float d=0.0;
float x=0.0;
float y=0.0;
cout <<"value of a:";
cin>>a;
cout <<"value of b:";
cin>>b;
cout <<"value of c:";
cin>>c;
d=sqrt(b*b-4*a*c);
x=(-b+d)/(2*a);
y=(-b-d)/(2*a);
if (x==y)
{
cout<<"Both roots are equal\n";
}
else(x!=y)
{
cout<<"The roots are not the same\n";
}
cout<<x;
cout<<y;
cout<<"\n";
return 0;
}