Thread: Hello Student Coder here

  1. #1
    Registered User
    Join Date
    Jul 2013
    Posts
    12

    Hello Student Coder here

    I have been asked to draw an ASCII house, however I am running into trouble making my stories.

    Here is what I need clarification on:
    Can I make a do/while loop inside a for loop?

  2. #2
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    yes you can
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    > Can I make a do/while loop inside a for loop?
    Yes.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    - - - - - - - - oogabooga's Avatar
    Join Date
    Jan 2008
    Posts
    2,808
    Quote Originally Posted by The Geeky Coder View Post
    I have been asked to draw an ASCII house, however I am running into trouble making my stories.

    Here is what I need clarification on:
    Can I make a do/while loop inside a for loop?
    Absolutely!
    Code:
    for (i = 0; i < n; i++)
    {
        do
        {
            ...
        }
        while (j != q);
    }
    And can I suggest that you make a castle instead of a house?
    That way the stories can be about knights and dragons, very popular nowadays.

  5. #5
    Registered User
    Join Date
    Jul 2013
    Posts
    12
    The assignment specifically asked for houses though

    I finally figured out how to do storey, the problem here is the windows.

    So far what it displays to me is this:

    | |
    | |
    | |
    | |
    | |
    | |
    | |
    -------------------------


    do I draw the windows as the program draws the walls?

    *damn it wont display the exact picture that my program draws :\
    Last edited by The Geeky Coder; 07-13-2013 at 09:58 AM.

  6. #6
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    Quote Originally Posted by The Geeky Coder View Post
    The assignment specifically asked for houses though

    I finally figured out how to do storey, the problem here is the windows.

    So far what it displays to me is this:

    | |
    | |
    | |
    | |
    | |
    | |
    | |
    -------------------------


    do I draw the windows as the program draws the walls?

    *damn it wont display the exact picture that my program draws :\
    Use code tags, and a leading space might be needed.

    Code:
    |                            |
    |                            |
    |                            |
    |                            |
    |                            |
    |                            |
    |                            |
    -------------------------
    Tim S.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  7. #7
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    To make your output keep it's correct format, put [*code] Your Drawing or code here [*/code], we call them code tags, around what you want. Remove the *'s, to make them work.

    Code:
         =
        / \
       /   \
      /     \
     /       \ 
    /=========\
    |         |
    |   ▓▓    |
    |  ____   |
    |  |░░|   |
    |  |░░|   |
    ===========
    Unfortunately, the display won't be quite precise, because even between the code tags, some kerning is done to enhance spacing - but it will massively help.

    Best to draw out what you want, and then construct the house in a house[][] array of chars, from top to bottom. Then print out each row of the house array, until you're happy with it.
    Last edited by Adak; 07-13-2013 at 10:52 AM.

  8. #8
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Is this a colleague of yours?
    Need a little help with this program
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  9. #9
    Registered User
    Join Date
    Jul 2013
    Posts
    12
    Here is another question, how do I read alphabets?

  10. #10
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,909
    Quote Originally Posted by The Geeky Coder View Post
    Here is another question, how do I read alphabets?
    This question is so vague, I have no idea what it means, and whether it's related to the house or it's a new topic. New topics/unrelated questions should be in their own thread. What does "read alphabets" mean exactly? Please provide context and/or examples.

  11. #11
    Registered User
    Join Date
    Jul 2013
    Posts
    12
    Quote Originally Posted by anduril462 View Post
    This question is so vague, I have no idea what it means, and whether it's related to the house or it's a new topic. New topics/unrelated questions should be in their own thread. What does "read alphabets" mean exactly? Please provide context and/or examples.
    It asks the user if the it wants (f)lat, (g)able, or (p)itched:

    you then read the alphabet the user inputs to call the proper function.

    oh my nevermind, I found about "char" :\ sorry for the confusion
    Last edited by The Geeky Coder; 07-16-2013 at 02:50 PM.

  12. #12
    Registered User
    Join Date
    Jul 2013
    Posts
    12
    Quote Originally Posted by Salem View Post
    Is this a colleague of yours?
    Need a little help with this program
    actually it might be! however we might be in different classes.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C# for a C++ coder
    By KIBO in forum C# Programming
    Replies: 5
    Last Post: 04-07-2012, 01:10 AM
  2. New coder, simple help please.
    By Mentallic in forum C Programming
    Replies: 13
    Last Post: 03-21-2010, 06:44 AM
  3. new coder using Dev C++
    By newcoder3333 in forum C++ Programming
    Replies: 3
    Last Post: 07-29-2006, 05:35 PM
  4. HL2 mod needs coder
    By livewire in forum Projects and Job Recruitment
    Replies: 0
    Last Post: 07-30-2005, 10:29 AM
  5. Stoned Coder Is Here
    By Troll_King in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 08-23-2002, 12:08 PM