C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » Graphics »

C++ Code to Draw a Hut using "graphics.h" header


Posted Date: 17 Jun 2009    Resource Type: Code Snippets    Category: Graphics
Author: PoojaMember Level: Silver    
Rating: 1 out of 5Points: 5



/* I have built a sweet home in graphics */

#include < stdio.h >
#include < graphics.h >
#include< stdlib.h >
#include< conio.h >
void main()
{
int gm,x,y,gd=DETECT,i;
// int midx, midy;
int stangle = 45, endangle = 50;
int radius = 50;
initgraph(&gd,&gm,"z:\\tc\\bgi");
x=getmaxx();// to get the co-ordinates i.e. x & y
y=getmaxy();
cleardevice();
fflush(stdout);// this is the function in c to clean the screen
line(200,150,350,150);
line(140,200,200,150);
line(140,330,140,200);
line(250,200,140,200);
line(200,150,250,200);
circle(196,180,15);
setfillstyle(2,14);
floodfill(196,180,15);
setfillstyle(1,2);
line(350,150,400,200);
floodfill(210,180,15);
line(400,200,400,330);
line(140,330,400,330);
line(250,200,250,330);
line(250,200,400,200); // Hut


setfillstyle(5,7);
floodfill(260,180,15);
line(170,260,170,330);
line(170,260,210,260);
setfillstyle(10,9);
floodfill(180,250,15);
line(210,260,210,330);
setfillstyle(9,9);
floodfill(210,250,15);
line(290,110,290,150);
line(310,110,310,150);
ellipse(300,110,0,360,10,3); // Chemney


setfillstyle(6,8);
floodfill(300,120,15);
line(300,250,350,250);
line(300,280,350,280);
line(300,250,350,280);
line(300,280,300,250);
line(350,280,350,250);

setfillstyle(9,9);
floodfill(252,300,15);
setfillstyle(8,9);
floodfill(342,270,15);
// midx = getmaxx() /4 ;
// midy = getmaxy() /4 ;
// setcolor(getmaxcolor());

setcolor(2);
/* draw arc */
arc(30,300,stangle, endangle, radius);

setcolor(8);
line(5,330,600,330);
for(i=0;i<650;i=i+10)
{
setcolor(4);
settextstyle(7,0,5);
outtextxy(0+i,390,"Home Sweet Home");
delay(100);
setcolor(0);
settextstyle(7,0,5);
outtextxy(0+i,390,"Home Sweet Home");
}
getch();
closegraph();
}



Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
Home in graphics  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Bouncing ball
Previous Resource: Power point presentation in VB.net
Return to Discussion Resource Index
Post New Resource
Category: Graphics


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use