Home / C / Program in C to draw a STAR

Program in C to draw a STAR

In this program to draw a star you only have to give the coordinates of the lines that make a star.
You have to use the c graphics function line(x1,y1,x2,y2) to draw the line.
#include<stdio.h>
#include<graphics.h>
#include<conio.h>
void main()
{
int gd=DETECT,gm;
initgraph(&gd,&gm,"C:\\TC\\bgi");
line(150,100,100,200);
line(100,200,200,200);
line(200,200,150,100);
line(100,125,200,125);
line(100,125,150,225);
line(150,225,200,125);
getch();
closegraph();
}

 

OUTPUT:

Tags: C program to draw a star pattern, graphics program in c for star.

 

Check Also

Restrict Mouse Pointer Position C Graphics Program

This C Program will restrict the Mouse Pointer location or to a particular position or x,y ...

Leave a Reply

Your email address will not be published. Required fields are marked *

Preventing spam * Time limit is exhausted. Please reload the CAPTCHA.