Skip to main content

Draw House in c and cpp programming with graphics

Draw House in your c compiler with graphics. You can implement this source code on c compiler this code is very simple made up with some easy command like: Delay, Setcolor, Line, Arc.

initgraph function initializes graphics on the main program.
initgraph(&gdriver,&gmode,"c:\\turboc3\\bgi");
& points to the address of Graphics drive and Graphics mode defined by gdrive and gmode, you can change these strings with your own string like: gd as short of gdrive. And gdrive also having a function named as DETECT, used to detect the modes and graphics code over the program.

Code :
#include<iostream.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
void dda( float xa, float ya, float xb, float yb);
void main()
{
clrscr();
int gdriver=DETECT,gmode;
initgraph(&gdriver,&gmode,"c:\\turboc3\\bgi");
for(int i=16;i>=14; i--)
{
delay(900);
setcolor(i);
line(216,110,410,110);
}
for(int i1=16;i1>=14; i1--)
{
delay(900);
setcolor(i1);
line(216,110,216,250);
}
for(int i2=16;i2>=14; i2--)
{
delay(900);
setcolor(i2);
line(216,250,410,250);
}
for(int i3=16;i3>=14; i3--)
{
delay(900);
setcolor(i3);
line(410,110,410,250);
}
for(int i4=16;i4>=14; i4--)
{
delay(900);
setcolor(i4);
line(216,120,410,120);
}for(int i5=16;i5>=14; i5--)
{
delay(900);
setcolor(i5);
line(216,110,313,10);   }
for(int i6=16;i6>=14; i6--)
{
delay(900);
setcolor(i6);
line(410,110,313,10);
}for(int i7=16;i7>=14; i7--)
{
delay(900);
setcolor(i7);
line(250,250,250,150);   }
for(int i8=16;i8>=14; i8--)
{
delay(900);
setcolor(i8);
line(300,250,300,150);
}for(int i9=16;i9>=14; i9--)
{
delay(900);
setcolor(i9);
line(250,150,300,150);
 }for(int i10=16;i10>=14; i10--)
{
delay(900);
setcolor(i10);
line(320,150,320,200);   }
for(int i11=16;i11>=14; i11--)
{
delay(900);
setcolor(i11);
line(390,150,390,200);  }for(int i111=16;i111>=14; i111--)
{
delay(900);
setcolor(i111);
line(320,150,390,200);   }
for(int i12=16;i12>=14; i12--)
{
delay(900);
setcolor(i12);
line(320,200,390,150);
}for(int i13=16;i13>=14; i13--)
{
delay(900);
setcolor(i13);
line(320,150,390,150);
}for(int i14=16;i14>=14; i14--)
{
delay(900);
setcolor(i14);
line(320,200,390,200);  }
for(int i15=16;i15>=14; i15--)
{
delay(900);
setcolor(i15);
circle(313,60,10);       }
for(int i16=16;i16>=14; i16--)
{
delay(900);
setcolor(i16);
line(410,120,480,90);
}
for(int i17=16;i17>=14; i17--)
{
delay(900);
setcolor(i17);
line(313,10,480,90);
}
for(int i18=16;i18>=14; i18--)
{
delay(900);
setcolor(i18);
line(410,250,480,220);
}
for(int i19=16;i19>=14; i19--)
{
delay(900);
setcolor(i19);
line(480,90,480,220);     }for(int i20=16;i20>=14; i20--)
{
delay(900);
setcolor(i20);
line(410,110,468,87);      }for(int i21=16;i21>=14; i21--)
{
delay(900);
setcolor(i21);
line(436,150,460,140);      }for(int i22=16;i22>=14; i22--)
{
delay(900);
setcolor(i22);
line(437,200,461,190);       }for(int i23=16;i23>=14; i23--)
{
delay(900);
setcolor(i23);
line(437,150,437,200);    }for(int i24=16;i24>=14; i24--)
{
delay(900);
setcolor(i24);
line(460,140,460,190);     }for(int i25=16;i25>=14; i25--)
{
delay(900);
setcolor(i25);
line(436,160,460,150);
}for(int i26=16;i26>=14; i26--)
{
delay(900);
setcolor(i26);
line(436,190,460,180);
}for(int i27=16;i27>=14; i27--)
{
delay(900);
setcolor(i27);
circle(448,170,12);
}for(int i28=16;i28>=14; i28--)
{
delay(900);
setcolor(i28);
arc(185,275,300,20,70);
}for(int i29=16;i29>=14; i29--)
{
delay(900);
setcolor(i29);
arc(235,275,300,20,70);
 }
for(int i30=16;i30>=14; i30--)
{
delay(900);
setcolor(i30);
outtextxy(100,400,"cprogrammingbyakshay.blogspot.in");
 }
getch();
}

Output 


Comments

  1. Whilst good nutrition is amongst the most crucial aspects of a child's health, might know
    about give our little ones to drink is simply as significant as the
    standard of food we provide them with to eat.
    Other than this, proper baby medicines are
    widely-used to conserve the health in the kids. Her chiropractor performed
    low amplitude, high velocity manipulation down the 3 spinal locations and almost 1.

    ReplyDelete

Post a Comment

Popular posts from this blog

Balloon Shooting game in cpp

Balloon Shooting Game is a simple game using c and cpp features. You can easily learn and is easy to run because this game works in TURBOC compiler. The main features are included is  GRAPHICS and DOS commands. Basic commands used in this game : initgraph : initgraph is used to initialising of graphics mode in the program.                   ex. initgraph(&gm,&gd,"akshay"); here gm uses Graphics detect mode and gd points to graphics features to be used in program ans last is a string it may be any string like c://tc/bin etc.. setbkcolor : sets the current background color.    for ex. if you want to set background color to blue, you can call   setbkcolor(BLUE); or setbkcolor(1); getimage : saves a bit image of the specified region into memory. putimage : outputs a bit image onto the screen. settextstyle : sets the current text characteristics.     Declaration : settextstyle(int font,...

Minesweeper Game in C

Minesweeper Game in C language. This game is like a windows minesweeper game and I am giving you all the code for this game. You can easily understand the code if you are not a beginner. For beginners this code will quite hard to understand. Because in this code it contains mouse pointing function, graphics function, and so many other codes which makes it so hard to play and is a mind game. So play and enjoy it.   Click here for code Click for code

Make your own paint application in c and cpp

Paint application using simple turboc complier. Hello friends now make your own paint application or mini project in your simple c and cpp compiler. click to show the code for paint program