C新手遇到ld returned 1 exit status求大神
程序代码:
#include<stdio.h> #include<math.h> #include<stdlib.h> int main() { float a,b,c,d,d2,d3,d4,result1,result2; printf("Please input three float numbers:"); scanf("%f %f %f",&a,&b,&c); d=b*b-4*a*c; if(a==0) { printf("The equation is not quadratic."); } else { if(d>0) { d2=sqrt(d); result1=(-b+d2)/(2*a); result2=(-b-d2)/(2*a); printf("The equation has two distinct real roots:%.4f and %.4f",result1,result2); } else if(d<0) { d3=sqrt(-d); d4=(-b)/(2*a); printf("The equation has two complex roots:%.4f+%.4fi and %.4f-%.4fi",d4,d3,d4,d3); } else { d2=sqrt(d); result1=(-b+d2)/(2*a); printf("The equation has two equal roots:%.4f",result1); } } systems("pause"); return 0; }