Graphics function in c programmin |
Graphics programming in C is very simple and interesting. It is one of the most powerful features of C programming. Use of graphics makes the computer application beautiful and effective. It is mainly used to develop games, create projects and putting the animation.
C graphics can be used to display text in different shapes
like circles, lines, rectangle, bars and many other geometrical figures. You
can change their colors using the functions and fill them.
So lets now see some basic function used in c programing.
Today we will discuss the following function with program example.
Line function in c
Line() function is used to draw a line from a start point(x1,y1) to
end point (x2,y2). It contains four arguments, first two arguments represent
the x and y coordinates of the starting point of line and last two arguments
represent the x and y coordinates of the ending point of the line.
Syntax
Void line(int x1, int y1,int x2, int
y2);
Example for line()
#include<stdio.h>
#include<graphics.h>
Main()
{
Int gd=DETECT,gm;
Initgraph(&gd,&gm,”c:\\tc\\bgi”);
Line(50,100,200,100);
Getch();
Closegraph();
Return 0;
}
Circle function in c
circle function is used to draw a
circle on the screen with a given radius and center (x,y)
syntax
void circle(int x, int y, int radius);
example for circle() function
#include<stdio.h>
#include<graphics.h>
Main()
{
Int gd=DETECT,gm;
Initgraph(&gd,&gm,”c:\\tc\\bgi”);
circle(150,150,100);
Getch();
Closegraph();
Return 0;
Conclusion
So finally to we see about introduction
to graphics in c. if you
have any question related to this topic then please comment it in the comment
box below we definitely answer you.
If you like our content then please
share with your friends and social media. And also if you want information related
to any topic then comment it we will try to write article on it.
tags- graphics in c,graphics in c++ in hindi, graphics programming in hindi,graphics tutorial in c, how to run graphics program in c.
0 Comments