一个最优美的图案

简介: 一个最优美的图案。

一个最优美的图案(在TC中实现)。

程序分析:无。

include "graphics.h"

include "math.h"

include "dos.h"

include "conio.h"

include "stdlib.h"

include "stdio.h"

include "stdarg.h"

define MAXPTS 15

define PI 3.1415926

struct PTS {
int x,y;
};
double AspectRatio=0.85;
void LineToDemo(void)
{
struct viewporttype vp;
struct PTS points[MAXPTS];
int i, j, h, w, xcenter, ycenter;
int radius, angle, step;
double rads;
printf(" MoveTo / LineTo Demonstration" );
getviewsettings( &vp );
h = vp.bottom - vp.top;
w = vp.right - vp.left;
xcenter = w / 2; / Determine the center of circle /
ycenter = h / 2;
radius = (h - 30) / (AspectRatio 2);
step = 360 / MAXPTS; /
Determine # of increments /
angle = 0; /
Begin at zero degrees /
for( i=0 ; i<MAXPTS ; ++i ){ /
Determine circle intercepts /
rads = (double)angle
PI / 180.0; / Convert angle to radians /
points[i].x = xcenter + (int)( cos(rads) radius );
points[i].y = ycenter - (int)( sin(rads)
radius AspectRatio );
angle += step; /
Move to next increment /
}
circle( xcenter, ycenter, radius ); /
Draw bounding circle /
for( i=0 ; i<MAXPTS ; ++i ){ /
Draw the cords to the circle /
for( j=i ; j<MAXPTS ; ++j ){ /
For each remaining intersect /
moveto(points[i].x, points[i].y); /
Move to beginning of cord /
lineto(points[j].x, points[j].y); /
Draw the cord */
}
}
}
int main()
{
int driver,mode;
driver=CGA;mode=CGAC0;
initgraph(&driver,&mode,"");
setcolor(3);
setbkcolor(GREEN);
LineToDemo();
}

相关文章
|
存储 SQL 关系型数据库
20. Mysql 游标的定义和使用
20. Mysql 游标的定义和使用
235 1
|
大数据 Android开发
Android使用AIDL+MemoryFile传递大数据
Android使用AIDL+MemoryFile传递大数据
275 0
|
人工智能 Python
【Python + 微信】微信公众号开发避坑指南
【Python + 微信】微信公众号开发避坑指南
338 0
|
存储 SQL 关系型数据库
数据架构:概念与冷热分离
关于架构,大家都有了解和理解。通常一个业务或项目,在做架构设计时,可能会包含业务架构和技术架构。其中技术架构是我们作为开发角色,在做设计时重点的工作内容。但还有架构类型的划分方式,会包括业务架构、技术架构、数据架构和应用架构四种。
377 0
|
安全 网络安全 数据安全/隐私保护
|
敏捷开发 XML 架构师
「敏捷模型」敏捷架构:规模化敏捷开发的策略(上)
「敏捷模型」敏捷架构:规模化敏捷开发的策略
|
XML Java 数据格式
spring-bean配置信息重用(继承)和bean创建顺序是什么以及bean 对象的单例和多例讲解
spring-bean配置信息重用(继承)和bean创建顺序是什么以及bean 对象的单例和多例讲解
223 0
|
安全 网络协议 区块链
ENS 域名终极指南
以太坊域名服务是目前以太坊上最受欢迎的项目之一,这是有充分理由的。正如官方网站所介绍,“ENS 提供了一种安全且去中心化的方式,使用简单、人类可读的名称来处理区块链内外的资源。”
675 0
ENS 域名终极指南
|
存储 搜索推荐 数据可视化
|
JSON 数据格式
【解决方案 十七】序列化反序列化时枚举值如何显示为字符串
【解决方案 十七】序列化反序列化时枚举值如何显示为字符串
283 0

热门文章

最新文章