lines.c

来自「Computes the length of a line using two 」· C语言 代码 · 共 29 行

C
29
字号
#include "Lines.h"#include<math.h>#include<stdlib.h>double length_line(struct line *l)	//use this to measure the distance between the 2 points{	double line_len = 0;	line_len = distance_between_points(&l[0].p1, &l[0].p2);		//store these points at p1 and at p2 from the array	return line_len;}    double distance_between_points(struct point *p1, struct point *p2) 	{	double dist = 0;	//initialize	dist = sqrt(pow((p1[0].x - p2[0].x) , 2) + pow((p1[0].y - p2[0].y) ,  2));	//given the input vlaues, calculate the distance using pathagoryn theorm.											//This requires use of the math library 	return dist;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?