The first thing I'm going to do is save Paul the eventual trouble. Have a look at these threads and see what the recurring issue is. I'm not sure if you are including more non-standard headers than just iostream.h, but someone else will let you know.
Something else that will be mentioned (by either Paul or CPUWizard ) is getch() no doubt. Even though you may be learning, it is a bad habit to use it to stop the program from executing.
Edit: You say that it "kind of looks like this"... but in your code it is 40 wide by 22 high. Could you please show us how it is supposed to look exactly?
Last edited by Mybowlcut; January 3rd, 2009 at 07:57 AM.
so can you please help me with the other 3 right triangles please.?..
what's the program on those 3.. nested for loop...
Your program gets to a point where x is 23 which is <= 40, but then y is set to x in the nested loop and since 23 > 22, the outer loop gets executed 17 more times unnecessarily. Is this what you intended? Can you please post an exact replica of how the image is supposed to look, so that people can offer you suggestions that are going to help?
1) Others have already said the basics of what I would say.
2) Posts such as http://www.codeguru.com/forum/showth...34#post1797834 have no basis anywhere on the forums (and have been reported to the moderator4s)
3) Please go back ad RE-READ the FAQS, especially the one "Why we DONT do homework".
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009 In theory, there is no difference between theory and paractice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
for ( you_to_do; you_to_do; ++var )
for ( more4utodo; more4utodo; --var )
draws the top half of the pattern. The bottom half is a mirror image of the top and so you should be able to do it easily.
On another note, do not hijack other peoples threads in the way you did. Make your thread, with a descripive title, and wait for help which usually comes when you show some effort yourself.
Get Microsoft Visual C++ Express here or CodeBlocks here.
Get STLFilt here to radically improve error messages when using the STL.
Get these two can't live without C++ libraries, BOOST here and Loki here.
Check your code with the Comeau Compiler and FlexeLint for standards compliance and some subtle errors.
Always use [code] code tags [/code] to make code legible and preserve indentation.
Do not ask for help writing destructive software such as viruses, gamehacks, keyloggers and the suchlike.