The graphics.h library allows us to create simple graphical drawings using basic shapes. In this program, circles, rectangles, and lines are combined to draw a simple house. The circles represent the sun and a window, rectangles form the walls and door, and lines create the roof.
How It Works?
graphics.h header file.initgraph().setcolor().circle() function.rectangle() function.line() function.getch().#include <stdio.h> #include <conio.h> #include <graphics.h> main() { int gd = DETECT, gm; initgraph(&gd, &gm, "c:\\turboc3\\bgi"); setcolor(7); circle(20, 40, 50); circle(200, 155, 20); rectangle(150, 180, 250, 300); rectangle(250, 180, 420, 300); rectangle(180, 250, 220, 300); line(200, 100, 150, 180); line(200, 100, 250, 180); line(200, 100, 370, 100); line(370, 100, 420, 180); getch(); }