x1,x2都开根号,可以写到一起
(2*a)要加括号
#include<cstdio>
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
double a,b,c;
cin>>a>>b>>c;
double t=b*b-4*a*c;
if(a==0||t<0) printf("Impossivel calcular\n");
else
{
t=sqrt(t);
double x1=(-b+t)/(2*a);
double x2=(-b-t)/(2*a);
printf("R1 = %.5lf\n",x1);
printf("R2 = %.5lf\n",x2);
}
return 0;
}