drawing using * (asterisk)... simulation
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 11 of 11

Thread: drawing using * (asterisk)... simulation

  1. #1
    Join Date
    Jan 2009
    Posts
    4

    Exclamation deleted

    deleted
    Last edited by mary_althene; January 4th, 2009 at 06:22 AM.

  2. #2
    Join Date
    Nov 2006
    Location
    Australia
    Posts
    1,569

    Re: drawing using * (asterisk)... simulation

    What code have you written for it so far?
    Good judgment is gained from experience. Experience is gained from bad judgment.
    Cosy Little Game | SDL | GM script | VLD | Syntax Hlt | Can you help me with my homework assignment?

  3. #3
    Join Date
    Jan 2009
    Posts
    4

    Re: drawing using * (asterisk)... simulation

    deleted
    Last edited by mary_althene; January 4th, 2009 at 06:19 AM.

  4. #4
    Join Date
    Nov 2006
    Location
    Australia
    Posts
    1,569

    Re: drawing using * (asterisk)... simulation

    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 08:57 AM.
    Good judgment is gained from experience. Experience is gained from bad judgment.
    Cosy Little Game | SDL | GM script | VLD | Syntax Hlt | Can you help me with my homework assignment?

  5. #5
    Join Date
    Jan 2009
    Posts
    4

    Unhappy Re: drawing using * (asterisk)... simulation

    deleted
    Last edited by mary_althene; January 4th, 2009 at 06:19 AM.

  6. #6
    Join Date
    Nov 2006
    Location
    Australia
    Posts
    1,569

    Re: drawing using * (asterisk)... simulation

    Quote Originally Posted by mary_althene View Post
    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?
    Good judgment is gained from experience. Experience is gained from bad judgment.
    Cosy Little Game | SDL | GM script | VLD | Syntax Hlt | Can you help me with my homework assignment?

  7. #7
    Join Date
    Jan 2009
    Posts
    4

    Post Re: drawing using * (asterisk)... simulation

    deleted
    Attached Images Attached Images  
    Last edited by mary_althene; January 4th, 2009 at 06:19 AM.

  8. #8
    Join Date
    Mar 2002
    Location
    NY, USA
    Posts
    12,097

    Re: drawing using * (asterisk)... simulation

    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

  9. #9
    Join Date
    Nov 2008
    Location
    England
    Posts
    748

    Re: drawing using * (asterisk)... simulation

    Try to work out the algorithm in pseudocode.

    Look at the diagram.

    you print x stars

    you then print y dots.

    you then print x stars. and then a newline.

    now x increases

    you print x stars

    now y decreases

    you print y dots.

    you then print x stars and then a newline.

    See the pattern.....?
    Code:
    for ( you_to_do; you_to_do; ++var )
    {
       print_x_stars;
       for ( more4utodo; more4utodo; --var )
       {
          print_y_dots;
       }
       print_x_stars;
       print_a_newline;
    }
    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.

  10. #10
    Join Date
    Jan 2009
    Posts
    1

    Re: drawing using * (asterisk)... simulation

    *I deleted this Post*
    Last edited by chiped; January 3rd, 2009 at 02:28 PM. Reason: I m ot supposed to help with your homework

  11. #11
    Join Date
    Apr 1999
    Posts
    27,444

    Re: drawing using * (asterisk)... simulation

    Quote Originally Posted by chiped View Post
    below is the program written,
    Please remove your post. We do not give homework answers with code here.

    Read the FAQ concerning homework here:

    http://www.codeguru.com/forum/showthread.php?t=366302

    Regards,

    Paul McKenzie

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center