当前位置: 首页 > news >正文

C语言入门到精通之练习36:一个最优美的图案(在TC中实现)。

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

程序分析:无。

程序源代码:

实例

//  Created by www.erdangjiade.com on 15/11/9.
//#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();
}

希望你也学会了,更多编程源码模板请来二当家的素材网:https://www.erdangjiade.com

http://www.lryc.cn/news/293446.html

相关文章:

  • 【Nginx】nginx入门
  • 【数据结构】并查集(路径压缩)
  • FreeMark ${r‘原样输出‘} ${r“原样输出“}
  • nginx初学者指南
  • 第二十五天| 216.组合总和III、17.电话号码的字母组合
  • HTML+CSS:全景轮播
  • 【WPF.NET开发】​优化性能:布局和设计
  • go语言-context的基本使用
  • 《计算机网络简易速速上手小册》第9章:物联网(IoT)与网络技术(2024 最新版)
  • 开源博客项目Blog .NET Core源码学习(8:EasyCaching使用浅析)
  • windows下docker的使用
  • C语言——R/预处理详解
  • Unity_PackageManager缺失
  • Megatron-LM源码系列(七):Distributed-Optimizer分布式优化器实现Part2
  • [SWPUCTF 2021 新生赛]ez_unserialize
  • android tv开发-1,leanback 2
  • Spring Boot注解
  • JavaWeb中的Filter(过滤器)和 Listener(监听器)
  • mybatis查询修改mysql的json字段
  • 实时聊天系统
  • Spring-mvc、Spring-boot中如何在调用同类方法时触发AOP
  • 幻兽帕鲁服务器自动重启备份-python
  • C# Onnx yolov8 水表读数检测
  • 负载均衡下webshell连接
  • Spring面试大全-基础知识01
  • Transformer实战-系列教程4:Vision Transformer 源码解读2
  • cesium-水平测距
  • 【Android-Compose】手势检测实现按下、单击、双击、长按事件,以及避免频繁单击事件的简单方法
  • AUTOSAR汽车电子嵌入式编程精讲300篇-基于神经网络的CAN总线负载率优化(续)
  • python爬虫6—高性能异步爬虫