
#include <math.h>
void main()
{
printf("请输入两点的坐标:x1 y1 x2 y2\n")
double x1,x2,y1,y2
scanf("%lf%lf%lf%lf",&x1,&y1,&x2,&y2)
double dbJuli
dbJuli=sqrt(pow(x1-x2,2)+pow(y1-y2,2))
printf("距离为%lf:\n",dbJuli)
}
请开一个空的c程序编写框输入下面的文字就行了,如果还需要问题可以留言。。。。#include<stdio.h>
#include<math.h>
void main()
{
double x1,x2,y1,y2,d
printf("请输入x1的值")
scanf("%f",&x1)
printf("请输入y1的值")
scanf("%f",&y1)
printf("请输入x2的值")
scanf("%f",&x2)
printf("请输入y2的值")
scanf("%f",&y2)
d=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))
printf("%f\n",d)
}
代码如下:
#include<stdio.h>
#include<math.h>
struct point
{
double x
double y
}
struct point readPoint()
double distance(struct point p1,struct point p2)
int main(void)
{
struct point a,b
double dis
printf("\n distance! \n\n")
printf("please input the point(for example:1.0,2.0):")
a=readPoint()
printf("\nplease input the point(for example:1.0,2.0):")
b=readPoint()
dis=distance(a,b)
printf("\nthe distance is:%.2f\n",dis)
return 0
}
struct point readPoint()
{
struct point p
scanf("%lf,%lf",&p.x,&p.y)
return p
}
double distance(struct point p1,struct point p2)
{
double d
d=sqrt((p1.x-p2.x)*(p1.x-p2.x)+(p1.y-p2.y)*(p1.y-p2.y))
return d
}
C语言是一种计算机程序设计语言,它既具有高级语言的特点,又具有汇编语言的特点。它由美国贝尔研究所的D.M.Ritchie于1972年推出,1978年后,C语言已先后被移植到大、中、小及微型机上,它可以作为工作系统设计语言,编写系统应用程序,也可以作为应用程序设计语言,编写不依赖计算机硬件的应用程序。
它的应用范围广泛,具备很强的数据处理能力,不仅仅是在软件开发上,而且各类科研都需要用到C语言,适于编写系统软件,三维,二维图形和动画,具体应用比如单片机以及嵌入式系统开发。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)