#include <stdio.h>
#include <math.h>
int main() {
double a1,b1,c1,a2,b2,c2,d,e,f;
printf("a1 b1 c1 : ");
scanf("%lf %lf %lf",&a1,&b1,&c1);
printf("a2 b2 c2 : ");
scanf("%lf %lf %lf",&a2,&b2,&c2);
d = a1 * b2 - b1 * a2;
e = c1 * b2 - b1 * c2;
f = a1 * c2 - c1 * a2;
if(fabs(d) <= 1.0E-6) printf("No answer。\n");
else if((fabs(a1/a2 - b1/b2) <= 1.0E-6) && (fabs(a1/a2 - c1/c2) <= 1.0E-6))
printf("INF\n");
else printf("x = %.3lf, y = %.3lf\n",e/d,f/d);
return 0;
}
学生:徐克 夏嘉晖
时间: 2024-10-18 04:17:30