#include<stdlib.h>
int main()
{
float k,b,x1,y1,x2,y2
printf("请按照x1,y1,x2,y2的顺序依次输入\n")
scanf("%f,%f,%f,%f",&x1,&y1,&x2,&y2)
b=(y2-y1)/(x2-x1)
k=(y1-b)/x1
printf("y=%fx+%f\n",k,b)
return 0
}
#include <iostream>int main()
{
int a = 0,b = 0
printf("请输入一次方程的系数a和b(以逗号隔开):")
scanf("%d,%d",&a,&b)
double c = (double)-b / a
printf("一次方程 %dx+%d=0 的根是:x = %lf\n",a,b,c)
system("pause")
return 0
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)