展开全部
第一题:
#include "stdio.h"
int main(void)
{
//数值采用的是三位小数点的数字
float x1,y1,x2,y2;
printf("请分别输入x1,y1,x2,y2的值,并以空格分开,回车:/n");
scanf("%0.3f %0.3f %0.3f %0.3f",&x1,&y1,&x2,&y2);
//斜率是xielv,K值是kzhi,方程格式是y=xielv*x+kzhi
float xielv,kzhi ;
xielv = (y2-y1)/(x2-x1);
kzhi = (y1*x2-y2*x1)/(x2-x1);
printf("方程式是:y=%0.3f*x + %0.3f /n",xielv,kzhi);
float xx,yy;
printf("请分别输入x值,并回车:/n");
scanf("%0.3f",&xx);
yy = xielv*xx+kzhi;
printf("y的值是:%0.3f/n",yy);
return 0;
}
#include "stdio.h"
int main(void)
{
//数值采用的是三位小数点的数字
float x1,y1,x2,y2;
printf("请分别输入x1,y1,x2,y2的值,并以空格分开,回车:/n");
scanf("%0.3f %0.3f %0.3f %0.3f",&x1,&y1,&x2,&y2);
//斜率是xielv,K值是kzhi,方程格式是y=xielv*x+kzhi
float xielv,kzhi ;
xielv = (y2-y1)/(x2-x1);
kzhi = (y1*x2-y2*x1)/(x2-x1);
printf("方程式是:y=%0.3f*x + %0.3f /n",xielv,kzhi);
float xx,yy;
printf("请分别输入x值,并回车:/n");
scanf("%0.3f",&xx);
yy = xielv*xx+kzhi;
printf("y的值是:%0.3f/n",yy);
return 0;
}
追问
太棒了!!!第二题也帮忙做一下呗~~第三题就不用做了...
追答
你照葫芦画瓢啊,亲
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询