C graphics programm to draw a filled colored rectangle

















C graphics programm to draw a filled colored rectangle



#include <graphics.h>
#include <conio.h>

void main()
{
int d,m;
int left, top, right, bottom;

d=DETECT;
initgraph(&d,&m,"c:\\tc\\bgi");

left = getmaxx() / 2 - 50;
top = getmaxy() / 2 - 50;
right = getmaxx() / 2 + 50;
bottom = getmaxy() / 2 + 50;


setfillstyle(1,4);
rectangle(left,top,right,bottom);
floodfill(getmaxx()/2,getmaxy()/2,15);
getch();


closegraph();

}


Output :


5 comments:

Unknown said...

no output just showing undefined symbol to getmax

Anonymous said...

Just put #include and #include

Unknown said...

Linker Error: undefined symbol _closegraph in module CAL.cpp can anyone say what prblm is this

Anonymous said...

Firstly save your program in .c
After that , go to options>linker>libaries>then tick on graphics library and container class..
This should do

trhshsh said...

It works
Thanks 👍👍😌👍😌👍

Post a Comment