画心的源程序
来源:互联网 发布:剑三 洛阳 知其不可为 编辑:程序博客网 时间:2024/04/29 13:14
#include "stdio.h"
#include "graphics.h"
#include "math.h"
#define a 60
#define PI 3.1415926
float th=PI/180;
void StartPic(void)
{
int gr=DETECT,gm;
initgraph(&gr,&gm,"c://turboc2");
cleardevice();
}
void ClosePic(void)
{ getch();
restorecrtmode();
}
void DrawXin(int x0,int y0,int k)
{
float i,x,y,tx,ty;
for(i=-180.0;i<=180.0;i+=0.01)
{x=a*(2*cos(i*th)-cos(2*i*th));
y=a*(2*sin(i*th)-sin(2*i*th));/*心线性方程*/
tx=x;
ty=y;
x=tx*cos(k*th)-ty*sin(k*th)+x0;
y=y0-(ty*cos(k*th)+tx*sin(k*th));/*坐标旋转*/
putpixel(x,y,RED);}
setfillstyle(1,RED);
floodfill(320,240,RED);/*填充*/
}
void main() /*主函数*/
{StartPic();
DrawXin(320,240,90);/*旋转角度为90度*/
ClosePic();
}
此源程序已在Turboc2运行通过.
如有任何问题,请发邮件至:QQ:517624976@qq.com
注:本源代码属作者原创,如转载请注明出处,谢谢合作!
#include "graphics.h"
#include "math.h"
#define a 60
#define PI 3.1415926
float th=PI/180;
void StartPic(void)
{
int gr=DETECT,gm;
initgraph(&gr,&gm,"c://turboc2");
cleardevice();
}
void ClosePic(void)
{ getch();
restorecrtmode();
}
void DrawXin(int x0,int y0,int k)
{
float i,x,y,tx,ty;
for(i=-180.0;i<=180.0;i+=0.01)
{x=a*(2*cos(i*th)-cos(2*i*th));
y=a*(2*sin(i*th)-sin(2*i*th));/*心线性方程*/
tx=x;
ty=y;
x=tx*cos(k*th)-ty*sin(k*th)+x0;
y=y0-(ty*cos(k*th)+tx*sin(k*th));/*坐标旋转*/
putpixel(x,y,RED);}
setfillstyle(1,RED);
floodfill(320,240,RED);/*填充*/
}
void main() /*主函数*/
{StartPic();
DrawXin(320,240,90);/*旋转角度为90度*/
ClosePic();
}
此源程序已在Turboc2运行通过.
如有任何问题,请发邮件至:QQ:517624976@qq.com
注:本源代码属作者原创,如转载请注明出处,谢谢合作!
- 画心的源程序
- 汉诺塔的源程序
- 代理服务器的源程序
- 出错的qt源程序
- 一个记事本的源程序
- 汉诺塔的Java 源程序
- 代理服务器的源程序[转载]
- 代理服务器的源程序
- 未经斟酌的源程序
- DES的源程序
- 关于BIOSKEY()的源程序
- 计算拉格朗日插值的源程序
- C源程序的关键字
- Java源程序的运行
- 源程序的编译过程
- 拉格朗日插值法的MATLAB源程序
- 冒泡排序的源程序
- 遗传算法的C源程序
- “三国人物”之管理十戒
- VB2VB.NET 后注意的事项之二
- 走进用户体验时代
- VB2VB.NET 后注意的事项之三
- 正则表达式30分钟入门教程--作者:deerchao
- 画心的源程序
- 流驱动是如何加载的?(收集于CSDN论坛)
- datagridview回车事件
- mknod命令
- 在安排员工时,忽视了一些细节
- datagridview 按回车键横向移动问题
- text-overflow实现标题省略号功能
- App Store,应用程序商店绝非说开就开
- 辗转相除法,求公约数和公倍数.