请你帮帮我解一下这道题吧

img


#include<iostream>
//#include<math>
using namespace std;
int main()
{
    int a, b, c,x,y,x1,x2;
    cin >> a;
    cin >> b;
    cin >> c;
    if (b*b - 4*a*c < 0)
    {
        printf("have not sqrt");
    }
    if (b*b - 4 * a*c == 0)
    {
        x = -b / (2*a);
        cout <<"sqrt:"<< x << endl;
    }
    if (b*b - 4 * a*c > 0)
    {
        y = sqrt(b * b - 4 * a*c);
        x1 = (-b + y) / (2*a);
        x2 = (-b - y) / (2 * a); 
        printf("%.2f %.2f",x1,x2);
    }
}



#include<stdio.h>
#include<math.h>
void swap(double *x,double *y)
{
    double t=*x;
    *x=*y;
    *y=t;
}
int main()
{
    double a,b,c,tai,x1,x2;
    scanf("%lf %lf %lf",&a,&b,&c); 
    if(a<0)
        a*=-1,b*=-1,c*=-1;
    tai=b*b-4*a*c;
    if(tai<0)
        return 1;
    x1=(-b+sqrt(tai))/(2*a);
    x2=(-b-sqrt(tai))/(2*a);
    if(x1<x2)
        swap(&x1,&x2);
    printf("%.2f %.2f",x1,x2); 
    return 0;
}

img