Skip to content

Instantly share code, notes, and snippets.

@w3Abhishek
Created July 24, 2021 10:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save w3Abhishek/176e12358397c9ee9145741e83244f26 to your computer and use it in GitHub Desktop.
Save w3Abhishek/176e12358397c9ee9145741e83244f26 to your computer and use it in GitHub Desktop.
C Program to Draw a Hut on Screen Using C Graphics. Go to https://codewin.org
#include<graphics.h>
#include<conio.h>
int main(){
int gd = DETECT,gm;
initgraph(&gd, &gm, "X:\\TC\\BGI");
/* Start Drawing the Structure of Hut */
setcolor(WHITE);
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);
/* Now, Fill the colors in the structure of our Hut */
setfillstyle(SOLID_FILL, BROWN);
floodfill(152, 182, WHITE);
floodfill(252, 182, WHITE);
setfillstyle(SLASH_FILL, BLUE);
floodfill(182, 252, WHITE);
setfillstyle(HATCH_FILL, GREEN);
floodfill(200, 105, WHITE);
floodfill(210, 105, WHITE);
getch();
closegraph(); /* Closing the graph */
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment