C++ Program to print a Man using Graphics

Posted in

C++ Program to print a Man using Graphics
vinaykhatri

Vinay Khatri
Last updated on February 11, 2025

When it comes to designing graphics using any programming language, we need to use a graphic library. In this C++ tutorial, we will learn how to print a Man using the C++ graphics library.

For this tutorial, I will be using the DEV C++ IDE and its default compiler to write and execute the program. If you are using any other IDE, you need to make sure that the graphics.h library is added to your compilers-dependent libraries. To know how to add graphics.h library to DevC++ and code block, click here .

C++Program to print a Man using Graphics

#include<graphics.h>

int main( ){
    initwindow( 700 , 700 , "Print A Man");
        
   //man head
   ellipse(320,95,360,0,25,20);
   //man cap
   line(298,85,341,85);
   //man left eye
   circle(310,90,2);
   //man right eye
   circle(330,90,2);
   //man smile
   arc(320,100,200,-20,10);

   //man left neck line
   line(313,115,313,125);
   //man right neck line
   line(328,115,328,125);


   //man sholder 
   arc(320,225,72,107,100);
   //man shirt left line
   line(290,129,290,200);
   //man shirt right line
   line(350,129,350,200);
   //man shirt buttom up line
   line(290,193,350,193);
   //man shirt buttom down line
   line(290,200,350,200);

   //man left leg left line
   line(290,200,285,280);
   //man left leg right line
   line(320,225,305,280);
   //man right leg left line
   line(322,225,335,280);
   //man right leg right line 
   line(350,200,355,280);

   //man left hand upper arm 
   line(290,129,255,165);
   //man left hand outer elbow
   line(255,165,290,200);
   //man left hand inner arm
   line(290,149,275,165);
   //man left hand inner elbow
   line(275,165,290,182);


   //right hand upper arm 
   line(350,129,385,165);
   //man right hand outer elbow
   line(385,165,350,200);
   //man right hand inner arm
   line(350,149,365,165);
   //man right hand inner elbow
   line(365,165,350,182);

   //man shoes left pointing pointer 
   line(285,280,275,287);
   //man left shoes base
   line(275,287,305,287);
   //man left shoes heel
   line(305,280,305,287);

    //man right shoes pointer
   line(335,280,335,287);
   //man right shoes base
   line(335,287,365,287);
   //man right shoes heel
   line(355,280,365,287);
	getch();
    return 0;
}

Output

Conclusion

In this C++ tutorial, we learned how to print a man using the C++ graphics library. In the above program, we have used just geometric shapes to design and man. By just looking at the program, you can tell that the program is all about drawing lines, circles, eclipses, and arcs.

People are also reading:

Leave a Comment on this Post

0 Comments