Like Tree4Likes
  • 2 Post By Matticus
  • 2 Post By whiteflags

Draw a Christmas tree

This is a discussion on Draw a Christmas tree within the C++ Programming forums, part of the General Programming Boards category; I need to set up a program which draws a Christmas tree that looks like this: # ### ##### ####### ...

  1. #1
    Registered User
    Join Date
    Dec 2012
    Posts
    1

    Draw a Christmas tree

    I need to set up a program which draws a Christmas tree that looks like this:

    #
    ###
    #####
    #######
    I
    I

    Where the user can input any value that is the tree height between 4-20.
    How would i go about setting up a proc that draws the branchlines for the corresponding tree height :/ PLEASE HELP

  2. #2
    Registered User
    Join Date
    Jun 2011
    Posts
    2,267
    Grab a pen and paper and start working on it by hand. Take note of the steps you take. Use this to develop an algorithm, which can then be translated to code. If the code doesn't work as expected, come back here and post it (using proper code tags) with questions, and we can help you further.
    King Mir and Elysia like this.

  3. #3
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,537
    Don't forget about the existence of flow charts, either!
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  4. #4
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,657
    In my opinion, a computer is the worst way. Bob Ross: Painting An Evergreen Tree - YouTube
    Salem and Matticus like this.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. christmas tree in c programming using loops.
    By poojaraghoo in forum C Programming
    Replies: 3
    Last Post: 10-09-2011, 02:29 PM
  2. draw tree graph of yacc parsing
    By talz13 in forum C Programming
    Replies: 2
    Last Post: 07-23-2006, 01:33 AM
  3. Christmas Songs
    By Betazep in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 12-21-2001, 06:44 PM
  4. What I Wan't For Christmas!
    By no-one in forum A Brief History of Cprogramming.com
    Replies: 34
    Last Post: 09-26-2001, 05:00 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21