Quadratic equation program

Sir/Ma’am,
I have written and tried the following code but it is showing a lot of errors so please tell me how can I correct this.

#include
using namespace std;
int main() {
int a,b,c,r1,r2;
cin>>a>>b>>c;
r1= (-b + sqrt(b^2 - 4ac))/2a;
r2= (-b - sqrt(b^2 - 4a
c))/2a;
d=sqrt(b^2 - 4a*c);
if(d>0){
cout<< Real and Distinct<<endl;
if(r1>r2)
{cout<<r1<<r2<<endl;}
else{
cout<<r2<<r1<<endl;
}
}
else if(d==0){
cout<< Real and Equal<<endl;
cout<<r1<<r2<<endl;
}
else{
cout<<Imaginary<<endl;
}
return 0;
}

hi @discobot refer

#include<iostream>
#include<cmath>
using namespace std;

int main() {
	int a,b,c,x1,x2;
	double d;
	cin>>a>>b>>c;
	d=b*b-4*a*c;

	if(d>0) {
          x1=((-b)+sqrt(b*b-4*a*c))/2*a;
		  x2=((-b)-sqrt(b*b-4*a*c))/2*a;
		  cout<<"Real and Distinct"<<endl;
		  cout<<min(x1,x2)<<" "<<max(x1,x2)<<" ";
	}
    else if(d==0){
		x1=(-b/2*a);
	    x2 = x1;
		cout<<"Real and Equal"<<endl;
		cout<<x1<<" "<<x2;
	}
	else{
		cout<<"Imaginary";
	}
	return 0;
}

Hi! To find out what I can do, say @discobot display help.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.