加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

满天星(C语言)

(2020-07-28 17:36:49)
标签:

it

教育

分类: 程序
#include "acllib.h"
#include "math.h"
#include“stdio.h”
 
void star(double s, int x, int y)
{
    double SR1 = s*sin(72), SR2 = s*sin(54), 
    CR1 = s*cos(72), CR2 = s*cos(54);
    int xA = x, yA = y-s;
    int xB = x+CR1, yB = y-SR1;
    int xC = x+SR2, yC = y-CR2;
    int xD = x-SR2, yD = y-CR2;
    int xE = x-CR1, yE = y-SR1;
    line(xE,yE,xB,yB);
    line(xA,yA,xC,yC);
    line(xC,yC,xE,yE); 
    line(xB,yB,xD,yD); 
    line(xD,yD,xA,yA);
}
int Setup() 
     
    int i;
    initWindow("小星星", DEFAULT, DEFAULT, 640, 480);
    beginPaint();
    setPenColor(BLACK);
    setBrushColor(BLACK);
    rectangle(0,0,640,480);
    for(i=0; i<1000; i++) 
    {
 满天星(C语言)

        setPenColor(RGB(R, G, B));
        
        star(8,X,Y);
    }
    endPaint();
    return 0;
}

满天星(C语言)

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有