Fundamentals of Computer Programming - Old Questions

10. Define the graphics function. Write a program to draw a circle using graphics function.

6 marks | Asked in 2073

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 we can make graphics programs, animations, projects, and games. We can draw circles, lines, rectangles, bars and many other geometrical figures. We can change their colors using the available functions and fill them. 

Program to draw a circle using graphics function

#include <stdio.h>

#include <graphics.h>

main()

{

    int gd = DETECT, gm;

    initgraph(&gd, &gm, "C:\\TC\\BGI");

    circle(100, 100, 50);

    getch();

    closegraph();

    return 0;

}