Giải phương trình hệ số phức
// giai phuong trinh he so phuc
#include <bits/stdc++.h>
using namespace std;
typedef complex<double> sp;
int main(){
sp a,b,c,d,x1,x2,K=0;
cout<<"a = "; cin>>a;
cout<<"b = "; cin>>b;
cout<<"c = "; cin>>c;
if(a==K){
if(b==K) cout<<(c==K > "vo so nghiem" : "vo nghiem");
else cout<<"x = "<<-c/b;
}else{
b/=-2; // ax^2 - 2bx + c = 0
d = sqrt(b*b-a*c);
cout<<"\nx1 = "<<(b-d)/a;
cout<<"\nx2 = "<<(b+d)/a;
}
}