程序太不健壮啦.
#include<stdio.h>
#include<math.h>
int sqr(int y);
int main()
{
long a,b,c,k;
double x1,x2;
double r;
printf("\nplease input three bits:\n");
scanf("%d %d %d",&a,&b,&c);
printf("\nthe fangcheng is : %dxx+%dx+%d=0\n",a,b,c);
k=b*b-4*a*c;
if(k>=0)
{r=sqrt(k);
x1=((-b)+r)/(2*a);
x2=((-b)-r)/(2*a);
printf("\nthe result are: %f %f\n",x1,x2);}
else
printf("\nit is not content for fangcheng\n");
return 0;
}
奋斗改变一切!!