Browse » Home
»
C/C++ Graphics program to make different shapes
» C/C++ Graphics program to make different shapes
C/C++ Graphics program to make different shapes
C/C++ Graphics program to make different shapes
#include <graphics.h>
#include <conio.h>
void main()
{
/* request auto detection */
int d,m;
d = DETECT;
int midx, midy;
/* initialize graphics and local variables */
initgraph(&d, &m, "d:\\tc\\bgi");
midx = getmaxx() / 2;
midy = getmaxy() / 2;
//major y-axis ellipse
setfillstyle(1,2);
fillellipse(midx-100,midy,30,70);
setfillstyle(1,4);
fillellipse(midx+120,midy,70,30);
setfillstyle(1,3);
pieslice(midx, midy, 0, 180, 30);
//rectangle
rectangle(midx-200,midy-100,midx+200,midy+100);
//circle
setfillstyle(1,1);
circle(200,70,40);
floodfill(200,70,15);
getch();
closegraph();
}
Output :
Subscribe to:
Post Comments (Atom)
1 comments:
To learn c graphics visit us on
Programmingcampus.com
Post a Comment