Solved

how to draw a simple house shape in c++

Posted on 1999-01-05
8
3,608 Views
Last Modified: 2008-03-10
i'm looking for source code to draw a simple "house" in c++.
i.e. four walls and a roof. each wall should be a different colour as should the roof. it should be seen from an elevated position and slightly to the side. i'm not allowed to have any c++ graphic fuctions in the code i.e. it should be a program which does it pixel by pixel (i think!).
0
Comment
Question by:rskell
8 Comments
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1181533
In case of windows:
Draw a picture in PaintBrush or something and now add this picture to your resources. Now you can display it from your resources.

Forget it, we need more info.
0
 
LVL 32

Accepted Solution

by:
jhance earned 300 total points
ID: 1181534
>i'm not allowed to have any c++ graphic

It sounds like this is some sort of homework problem.  Why don't you do a bit of research in the Windows SDK and try this yourself.  Then come back here and ask for some help on what you've already done.  Experts Exchange is not a "please do my homework for me" resource.

You might want to lookup the Win32 SetPixel() API function.

Another good resource is the Charles Petzold book, "Programming Windows"
0
 
LVL 86

Expert Comment

by:jkr
ID: 1181535
>>Why don't you do a bit of research in the Windows SDK and try
>>this yourself
jhance - did he mention Windows??? (Interesting 'answer' anyway: How to draw a house? See 'SetPixel()' or ask Petzold! <lol> ;-)
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 32

Expert Comment

by:jhance
ID: 1181536
jkr,

Did he say it _WASN'T_ Windows?  If it's not, then I'm sure he'll let us know....
0
 
LVL 86

Expert Comment

by:jkr
ID: 1181537
jhance,

i guess he will ;-)

I just thought you might have mixed up the C++ are with MFC or Windows (well, it sometimes happens to me ;-)
0
 

Author Comment

by:rskell
ID: 1181538
if you could just point me in the direction of a good resource
where i can find similar code and change it myself that would be great.
1
 
LVL 32

Expert Comment

by:jhance
ID: 1181539
I'm not sure what you're really asking about.  Do you need to know how to "draw" or how to "draw a house"?  

If you're asking how to "draw" in general on a computer display, then you can probably get some help here.  It's a very system/operating system dependent thing, however, and you haven't told us anything about your environment.  Is it WINDOWS, DOS, UNIX, X/Motif, Mac, Commodore 64, Nintendo, or what?

If it's how to draw a house in particular, I think you might want to consult an art book or something like that.
0
 
LVL 2

Expert Comment

by:gysbert1
ID: 1181540
There are no such things as C++ graphics functions so you should be safe there. Graphics functions are all implemented in software libraries that are mostly distributed with your compiler. Some windows API functions are available for drawing. You might want to use OpenGL for your "elevated position and slightly to the side" and then you could even rotate it.

Putpixel, LineTo, etc ... are all graphics functions provided with most compilers, but are all definately "c++ graphic fuctions".

You thus have a few options.
  1) Do not use C++ and use any graphics functions you like
  2) Use LOGO (I particularly like this one myself !)
  3) Get a class mate to do it for you and use C++ graphics functions (then you didn't)
  4) Declare it impossible and halt your studies. (Not recomended)
  5) Use printf and draw this : Simple House "seen from an
    elevated position and slightly to the side"

          o< ; ^)   /\
                     /  \
                    ------
                    |    |
                    ------

PS.

I think they should give a weekly prize on EE for the funniest comment by an expert ...

> ,,,, Commodore 64, Nintendo

HA HA HA HA HA ....

This made my day .
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Need some help with listview limit text 20 111
Installshield for Embarcadero EX 10.1 Berlin 4 60
Precision Problem in C++ 7 44
How do i run a c++ file? 15 46
Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question