Programming Blog

This blog is about technical and programming questions and there solutions. I also cover programs that were asked in various interviews, it will help you to crack the coding round of various interviews

Monday 20 August 2018

Draw basic shapes using graphics


#include<graphics.h>
#include<conio.h>
main()
{
   int gdd = DETECT,gmm,leftt=100,topp=100,rightt=200,bottomm=200,xx= 300,yy=150,radiuss=50;
   initgraph(&gdd, &gmm, "C:\\TC\\BGI");//initialization of graphics 
   rectangle(leftt, topp, rightt, bottomm);
   circle(xx, yy, radiuss);//xx is vertical axis, yy is horizontal axis
   bar(leftt + 300, topp, rightt + 300, bottomm);
   line(leftt - 10, topp + 150, leftt + 410, topp + 150);
   ellipse(xx, yy + 200, 0, 360, 100, 50);//draw ellipse
outtextxy(leftt + 100, topp + 325, " C Graphics Program (rectangle ,circle, bar, line, ellipse )");
   getch();
   closegraph();//closes the graphics
   return 0;
}

No comments:

Post a Comment