C Program To Create A House Using Graphics

C program to draw a house using

void main()

int gd = DETECT, gm;
// Initialize structure of
// the house
initgraph(&gd, &gm, "C:\\ TURBOC3\\BGI");

// Create lines for structure
// of the House
line(100, 100, 150, 50);

line(150, 50, 200, 100);

line(150, 50, 350, 50);
line(350, 50, 400, 100);

// Draw rectangle to give proper
// shape to the house
rectangle(100, 100, 200, 200);
rectangle(200, 100, 400, 200);
rectangle(130, 130, 170, 200);
rectangle(250, 120, 350, 180);

// Set color using setfillstyle()
// which take style and color as
// an argument
setfillstyle(2, 3);

// Fill the shapes with colors white
floodfill(131, 131, WHITE);
floodfill(201, 101, WHITE);

// Change the filling color
setfillstyle(11, 7);

// Fill the shapes with changed colors
floodfill(101, 101, WHITE);
floodfill(150, 52, WHITE);
floodfill(163, 55, WHITE);
floodfill(251, 121, WHITE);

// Close the initialized gdriver

Write a program in C to draw a hut and color it using graphics.h header file



Related Post

One Reply to “C Program To Create A House Using Graphics”

  1. Thanks for your write-up. Another factor is that being photographer requires not only issues in capturing award-winning photographs and also hardships in getting the best digital camera suited to your requirements and most especially hardships in maintaining the quality of your camera. This really is very true and visible for those photography fans that are into capturing a nature’s interesting scenes – the mountains, the particular forests, the particular wild or seas. Visiting these exciting places definitely requires a dslr camera that can surpass the wild’s severe environments.

Leave a Reply

Your email address will not be published. Required fields are marked *