#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
void Tow_real_root(double a,double b,double c,double num)
{
num[0] = ((-b) + pow((bb - 4.0 * ac), 0.5))/(2.0a);
num[1] = ((-b) - pow((bb - 4.0 * ac), 0.5)) / (2.0* a);
}
double One_real_root(double a, double b, double c)
{
return (-b1.0) / (2.0 * a);
}
int Zero_real_root(double a, double b, double c)
{
return 1;
}
int main()
{
double a = 0.0;
double b = 0.0;
double c = 0.0;
double num[2] = {0.0};
scanf("%lf %lf %lf",&a,&b,&c);
double flag = (bb - 4.0 * a*c);
if (flag > 0.0)
{
Tow_real_root(a, b, c, num);
for (int i = 0; i < 2;i++)
printf("%f “,num[i]);
}
else if (flag == 0.0)
{
printf(”%f\n",One_real_root(a, b, c));
}
else
{
if(Zero_real_root(a, b, c)==1);
printf(“不存在\n”);
}
system(“pause”);
return 0;
}
解二元一次方程
最新推荐文章于 2021-05-04 15:52:00 发布