资源简介
用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
相关资源
- C++自考笔记下
- 全套BT源代码,C++编写
- c++源码C-语法分析器源代码
- SegY地震体数据可视化分析工具 C++库
- C语言 员工考勤系统
- 学生成绩管理系统 C++设计
- C++面向对象的有限元程序设计
- c++词法分析器
- 基于51单片机DS18B20温度传感器设计的
- 编译原理语法分析程序(C语言)
- 数据结构和算法分析C语言描述习题答
- C语言项目实训程序书店销售管理系统
- 基于QT5开发漂亮的串口调试助手源码
- C语言-景区简易导航系统求最短路径
- linux下c语言写的俄罗斯方块
- 中文分词-C语言编写正向和反向最大匹
- MFC俄罗斯方块设计报告
- vc实现的telnet客户端的代码
- c语言语法分析器
- mp3的c语言解码程序
- c++模拟磁盘调度算法FCFS;SSTF;SCAN;
- C语言实现P-Q分解法潮流计算
- 数据结构 高校社团助手 C++
- 简单的鼠标绘图程序C语言
- C语言学生信息管理系统.rar
- FFT和DFT完整算法C语言实现
- 机器学习中决策树ID3算法 理论分析与
- 学生成绩管理系统.cpp
- 算法分析与设计 期末大作业.doc
- VC调用agilent矢量网络分析仪
评论
共有 条评论