c语言一朵花源代码

2022-07-14 13:17:12   第一文档网     [ 字体: ] [ 阅读: ] [ 文档下载 ]
说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。下载word有问题请添加QQ:admin处理,感谢您的支持与谅解。点击这里给我发消息

#第一文档网# 导语】以下是®第一文档网的小编为您整理的《c语言一朵花源代码》,欢迎阅读!
源代码,语言

/////////////////////////////////////////////////// // 程序名称:一束漂亮的花

// 编译环境:Visual C++ 6.0 / 2010EasyX 2011惊蛰版 // 者:yangw80 // 最后修改:2011-9-29 //

#include #include #include

#define PI 3.14159265

// 花朵

void flower(int x, int y, COLORREF c) {

int x1, y1, x2, y2;

int d = 15;

double e; setcolor(c);

for(double a = 0; a < 2 * PI; a += PI / 360) {



e = d * (1 + sin(a * 5));

x1 = int(x + e * cos(a)); y1 = int(y + e * sin(a));

x2 = int(x + e * cos(a + PI / 5)); y2 = int(y + e * sin(a + PI / 5)); line(x1, y1, x2, y2); }

// 蝴蝶结

void tie(int x, int y, COLORREF c) {

int x1, y1, x2, y2; }

int d = 80;

double e; setcolor(c);


for(double a = 0; a < 2 * PI; a += PI / 360) {



e = d * (1 + sin(a * 4));

x1 = int(x + e * cos(a)); y1 = int(y + e * sin(a) / 2); x2 = int(x + e * cos(a + PI / 9)); y2 = int(y + e * sin(a + PI / 9) / 4.5); line(x1, y1, x2, y2); }

// 主函数 void main() {

// 画花朵

flower(320, 160, RED); flower(200, 120, YELLOW); flower(150, 140, LIGHTRED);

flower(430, 176, RGB(255, 127, 0)); flower(370, 110, RGB(239, 179, 52)); flower(250, 72, RGB(235, 95, 186)); initgraph(640, 480);

// 画枝干

setcolor(GREEN);

line(189, 372, 180, 400); line(310, 160, 325, 68); line(310, 160, 187, 374); line(150, 140, 189, 374); line(430, 176, 190, 374); line(370, 110, 187, 374); line(250, 72, 189, 372); line(253, 192, 190, 374); line(189, 372, 187, 400); line(189, 372, 182, 400); line(189, 372, 200, 120); }


}

flower(325, 68, RGB(228, 119, 98)); flower(253, 190, RGB(247, 169, 117));

// 画蝴蝶结

tie(195, 354, LIGHTMAGENTA);

// 按任意键退出 getch(); closegraph();


本文来源:https://www.dywdw.cn/be2a1c20ed630b1c59eeb5cb.html

相关推荐
推荐阅读