五角星

#include <graphics.h>
#include <conio.h>
void three(int a,int b,int c)
{
    line(a,b,a-c/2,b+c);
    line(a,b,a+c/2,b+c);
    line(a+c/2,b+c,a-c/2,b+c);
}
void five(int h,int s,int x)
{
    line(h,s,h+x,s);
    line(h+x,s,h+x-x*0.809016994374947,s+x*0.587785252292473);
    line(h+x,s,h+x-x*0.809016994374947,s+x*0.587785252292473);
    line(h+x,s,h+x-x*0.809016994374947,s+x*0.587785252292473);
}
int main(int argc, char** argv) {
    int x=1000,y=1000;
    initgraph(x,y);
    
    setfillcolor(RED);
    
//    fillcircle(x/2-300,y/2-300,50);
//    fillcircle(x/2+300,y/2-300,50);
//    fillrectangle(x/2-25,y/2-25,x/2+25,y/2+25);
    //san(x/2,y/2,50);
    five(x/3,y/3,100);
    _getch();
    closegraph();
    return 0;
}

 

posted @ 2025-04-12 09:59  hanxuyao  阅读(14)  评论(0)    收藏  举报