Search This Blog

How to make 3D House in c graphics using turbo c++





 #include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<graphics.h>
#include<dos.h>
void main()
{
void home();

int gd=DETECT,gm=0;
clrscr();
initgraph(&gd,&gm,"c:\\turboc3\\bgi");

for(int i=0;i<400;)
 {
 putpixel(random(350+i),random(200),random(5+i));
 i=i++;
 home();
 }
getch();
}

void home()
{
setcolor(getmaxcolor());
settextstyle(GOTHIC_FONT,HORIZ_DIR,15);
outtextxy(180,0,"Happy");
settextstyle(GOTHIC_FONT,HORIZ_DIR,8);
outtextxy(440,170,"Home");

setfillstyle(SOLID_FILL,4);
circle(70,50,25);
floodfill(75,52,getmaxcolor());

setfillstyle(SOLID_FILL,3);
rectangle(270,250,430,430);
floodfill(271,251,getmaxcolor());

setfillstyle(SOLID_FILL,2);
rectangle(150,250,270,430);
floodfill(151,251,getmaxcolor());
arc(155,455,250,44,35);
arc(210,455,250,44,35);
setfillstyle(SOLID_FILL,7);
rectangle(180,310,240,430);
floodfill(181,311,getmaxcolor());

setfillstyle(SOLID_FILL,8);
rectangle(310,310,390,380);
floodfill(311,350,getmaxcolor());

setfillstyle(SOLID_FILL,9);
line(150,250,210,170);
line(270,250,210,170);
floodfill(200,230,getmaxcolor());

setfillstyle(SOLID_FILL,6);
circle(210,215,15);
floodfill(211,216,getmaxcolor());

setfillstyle(SOLID_FILL,5);
line(430,250,370,170);
line(210,170,370,170);
floodfill(215,172,getmaxcolor());
}
Share this article :

0 comments:

Post a Comment