dotnetspider.com
Login Login    Register      

TutorialsForumCareer DevelopmentResourcesReviewsJobsInterviewCommunitiesProjectsTraining

Subscribe to Subscribers
Talk to Webmaster
Tony John

Facebook
Google+
Twitter
LinkedIn
Online MembersA'zlina
More...
Join our online Google+ community for Bloggers, Content Writers and Webmasters




Resources » Code Snippets » Graphics

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


Posted Date:     Category: Graphics    
Author: Member Level: Silver    Points: 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();
}





Did you like this resource? Share it with your friends and show your love!


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

No responses found. Be the first to respond...

Feedbacks      

Post Comment:




  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)



    Type the numbers and letters shown on the left.


    Next Resource: Bouncing ball
    Previous Resource: Power point presentation in VB.net
    Return to Resources
    Post New Resource
    Category: Graphics


    Post resources and earn money!
     
    More Resources
    Popular Tags   Tag posting guidelines   Search Tags  
    Home in graphics  .  



    Follow us on Twitter: https://twitter.com/dotnetspider

    Active Members
    TodayLast 7 Daysmore...

    Awards & Gifts
    Email subscription
  • .NET Jobs
  • .NET Articles
  • .NET Forums
  • Articles Rss Feeds
    Forum Rss Feeds


    About Us    Contact Us    Copyright    Privacy Policy    Terms Of Use    Revenue Sharing sites   Advertise   Talk to Tony John
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
    2005 - 2012 All Rights Reserved.
    .NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
    Articles, tutorials and all other content offered here is for educational purpose only.
    We are not associated with Microsoft or its partners.