从键盘任意输入a,b,c的值,编程计算并输出一元二次方程ax2+bx+c=0的根,当a=0时,输出“该方程不是一元二次方程”,当a≠0时,分b2−4ac>0、b2−4ac=0、b2−4ac<0三种情况计算并输出方程的根。
**输入格式要求:"%f,%f,%f"
提示信息:“Please enter the coefficients a,b,c:”
**输出格式要求:“It is not a quadratic equation!\n”
“x1 = x2 = %.2f\n”
“x1 = %.2f, x2 = %.2f\n”
"x1 = %.2f+%.2fi, " “x2 = %.2f-%.2fi\n”
代码:
#include <stdlib.h>
#include <math.h>
#include <stdio.h>
#define EPS 1e-6
int main()
{
float a