CGMM | Basic graphics functions | Exp 1


Basic graphics functions

C graphics using graphics.h functions can be used to draw different shapes, display text in different fonts, change colors and many more. Using functions of graphics.h in Turbo C compiler you can make graphics programs, animations, projects, and games. You can draw circles, lines, rectangles, bars and many other geometrical figures. You can change their colors using the available functions and fill them.

Functions in graphics.h

  • line()
  • rectangle()
  • circle()
  • bar()
  • ellipse()     and many more

1. Rectangle function

Syntax: 
rectangle(int top, int left, int right, int bottom);
Here,

  • Left specifies the X-coordinate of top left corner.
  • Top specifies the Y-coordinate of top left corner.
  • Right specifies the X-coordinate of right bottom corner.
  • Bottom specifies the Y-coordinate of right bottom corner.

2. Circle function


Syntax: 
circle(int x, int x, int radius);
Here,

  • (x,y) represent center coordinates of circle.
  • Radius parameter specifies the radius of the circle.

Problem Statement

How an object is move from one location to another location for that design an object by using inbuilt graphics functions.

No comments:

Powered by Blogger.