VOOZH about

URL: https://www.geeksforgeeks.org/cpp/flying-bird-using-computer-graphics-in-c-c/

⇱ Flying Bird using Computer graphics in C/C++ - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Flying Bird using Computer graphics in C/C++

Last Updated : 23 Jul, 2025

In computer graphic, C++ provide graphic.h through which objects can be created and by using this objects flying bird can be created in C++ program.

Functions used in this program are as follows:

  • line(): The line function is used to draw a line. 
    Syntax:

line(x1, y1, x2, y2); 
where, (x1, y1) (x2, y2) are end points of the line. 
 

  • arc(): The arc function is used to draw an arc. 
    Syntax:

arc(x, y, start_angle, end_angle, r); 
where, (x, y) are centre of the arc, start_angle is the starting angle, end_angle is the ending angle and r is the radius of angle.

  • circle(): The circle function is used to draw a circle. 
    Syntax:

circle(x, y, r); 
where, (x, y) is the centre points and r is the radius of the circle.

  • delay(): The delay function is used to stop the screen for a certain time as the execution of program is very fast. 
    Syntax:

delay(n); 
where, n is number of seconds you want to stop the screen.

  • cleardevice(): The cleardevice function is used to clear the screen.
  • closegraph(): The closegraph function is used to close the graph.

Below is the C++ program implementing flying bird using graphics.h:

Output:

Comment
Article Tags: