资源简介
用c写的道格拉斯普克算法,是对点的压缩存储及其有效的一种方法
代码片段和文件信息
#include
#include
#include
#include
#define NULL 0
#define LEN sizeof(struct point)
struct point
{
char ptname[8];
float x;
float y;
struct point *next;
};
struct point* creat(void)
{
struct point *head;
struct point *p1*p2;
int n=0;
p1=p2=(struct point*)malloc(LEN);
scanf(“%s“p1->ptname);
head=NULL;
while(strcmp(p1->ptname“finish“)!=0)
{
printf(“请输入该点X Y坐标\n“);
scanf(“%f%f“&p1->x&p1->y);
n=n+1;
if(n==1)
head=p1;
else
p2->next=p1;
p2=p1;
p1=(struct point*)malloc(LEN);
printf(“请输入下一点点名\n“);
scanf(“%s“p1->ptname);
}
p2->next=NULL;
return(head);
}
struct point *getlast(struct point *p)
{
while(p->next!=NULL)
p=p->next;
return p;
}
float len(float x1float y1float x2float y2float x3float y3)
{
float abcsh;
a=sqrt((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2));
b=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
c=sqrt((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1));
s=0.5*(a+b+c);
h=(sqrt(s*(s-a)*(s-b)*(s-c)))*2/c;
return h;
}
void doglas(struct point *headstruct point *lastfloat si相关资源
- GD32通过规则组寄存器 DMA获取多组AD
- 基于MFC的TCP调试助手源码95706
- 国际象棋的qt源代码
- 操作系统c语言模拟文件管理系统844
- C语言开发实战宝典
- C++中头文件与源文件的作用详解
- 基于mfc的多线程文件传输
- C++多线程网络编程Socket
- VC++ 多线程文件读写操作
- C语言代码高亮html输出工具
- 猜数字游戏 c语言代码
- C语言课程设计
- 数字电位器C语言程序
- CCS FFT c语言算法
- 使用C语言编写的病房管理系统
- 通信过程中的RS编译码程序(c语言)
- 利用C++哈希表的方法实现电话号码查
- 计算机二级C语言上机填空,改错,编
- 用回溯法解决八皇后问题C语言实现
- 移木块游戏,可以自编自玩,vc6.0编写
- 简易教务管理系统c语言开发文档
- 操作系统课设 读写者问题 c语言实现
- 小波变换算法 c语言版
- C流程图生成器,用C语言代码 生成C语
- 3des加密算法C语言实现
- 简单的C语言点对点聊天程序
- 单片机c语言源程序(51定时器 八个按
- C++纯文字DOS超小RPG游戏
- 个人日常财务管理系统(C语言)
- MFC数字钟(基于VC6.0)
川公网安备 51152502000135号
评论
共有 条评论