另外,你的 逗号 全是用的 全角打字法,应该无法编译的。你把 逗号 也改过来吧。
程序代码:
# define M 510
#include <stdio.h>
#include <math.h>
main()
{
double x, T, a, j1, j2, x1, y1, x2, y2, x3, y3, x4, y4, j;
double i, c;
double f(double,double,double,double,double,double,double,double,double);
j1 = 52;
j2 = 40;
j = 50;
printf("请输入扭矩稳定时的最低点的数值:\n");
scanf("%lf,%lf",&T,&a);
printf("请输入您的瞬时扭矩的数值:\n");
fflush(stdin);
printf("请输入4个初始点:\n");
scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf", &x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
if (T < a) {
x = x1;
c = 10;
while (c >= 0.5) {
c = fabs(f(x, x1, y1, x2, y2, x3, y3, x4, y4) - T);
x++;
};
c = f(x++, x1, y1, x2, y2, x3, y3, x4, y4);
i = 1.5 * (M - j * (j1 - j2) * 1.0 / c);
printf("这是下一个时间段所对应的电流%f\n", i);
}
if (T >= a) {
i = 1.5 * (M - j * (j1 - j2) * 1.0 / T);
printf("这是下一个时间段所对应的电流%f\n", i);
}
}
double f(double x, double x1, double y1, double x2,double y2, double x3, double y3, double x4, double y4)
{
return (((x - x1) * (x - x2) * (x - x3)) / ((x4 - x1) * (x4 - x2) * (x4 - x3)) * y4 + ((x - x1) * (x - x2) * (x - x4)) / ((x3 - x1) *
(x3 - x2) * (x3 - x4)*y3 + ((x - x1) * (x - x4) * (x - x3)) / ((x2 - x1) * (x2 -x4) * (x2 - x3)) *y2 + ((x - x4) *
(x - x2) * (x - x3)) / ((x1 - x4) * (x1 - x2) * (x1 - x3)) * y1);
}