C++ : How to draw a face of human in Turbo C++


  • Draw a face of human in Turbo C++


Copy  Following Program And Paste In C

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

int main(void)
{
 
   int gdriver = DETECT, gmode, errorcode;
   int midx, midy;
   int radius = 200;                //circle
   int stangle = 0, endangle = 360; //ellipse
   int stangle1 =220, endangle1 =320;//arc
   int radius1 = 145;
   int xmax, ymax;   //line

   initgraph(&gdriver, &gmode, "");

  
   errorcode = graphresult();
   if (errorcode != grOk) 
   {
      printf("Graphics error: %s\n", grapherrormsg(errorcode));
      printf("Press any key to halt:");
      getch();
      exit(1);
   }

   midx = getmaxx() / 2;
   midy = getmaxy() / 2;
   setcolor(getmaxcolor());

   circle(midx, midy, radius);  //face outline
   circle(220, 190, 30);  // eye 1
   circle(410, 190, 30);  //eye 2          //xradius,yradius
   ellipse(midx, 270, stangle, endangle,25, 70);  //nose
   arc(midx, midy, stangle1, endangle1, radius1);  //mouth
   //    x,   y,  to x,to y
   line(223, 310, 194, 350); // side of mouth
   line(410, 310, 448, 355); // side of mouth
   /* clean up */
   getch();
   closegraph();
   return 0;
}
Previous Post Next Post