The used graphic functions and the header file graphics.h belong to the ancient Borland Turbo C - Wikipedia and Turbo C - Wikipedia IDE and compiler for creating MS-DOS programs. To use them with Linux you have to install a compatible library like libgraph - Summary Savannah ^ or The SDLbgi and libXbgi Libraries ^. I have already used InitGraph and have given the path(C: TC BGI) in Initgraph and checked the Graphics option also.Its my windows7 & turbo c 3. I just want to draw a circle by using graphics in c.But its showing while running undefined symbol circle in module noname.cpp.
graphics.h library is used to include and facilitate graphical operations in program. 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 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.
Examples:
Explanation :The header file graphics.h contains line() function which is described below :
Declaration : void line(int x1, int y1, int x2, int y2);
line function is used to draw a line from a point(x1,y1) to point(x2,y2) i.e. (x1,y1) and (x2,y2) are end points of the line.The code given below draws a line.
#include <graphics.h> // driver code { // gm is Graphics mode which is a computer display // DETECT is a macro defined in 'graphics.h' header file // by loading a graphics driver from disk line(150, 150, 450, 150); // line for x1, y1, x2, y2 line(150, 250, 450, 250); getch(); // closegraph function closes the graphics // by graphics system . } |
Output: