Like Tree1Likes
  • 1 Post By oogabooga

Hello Student Coder here

This is a discussion on Hello Student Coder here within the C Programming forums, part of the General Programming Boards category; I have been asked to draw an ASCII house, however I am running into trouble making my stories. Here is ...

  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
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,484
    yes you can
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,765
    > 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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  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.
    Matticus likes this.

  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 10:58 AM.

  6. #6
    Registered User
    Join Date
    May 2009
    Posts
    2,747
    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.
    "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the Universe is winning." Rick Cook

  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 11:52 AM.

  8. #8
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,765
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  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,640
    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 03: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, 02:10 AM
  2. New coder, simple help please.
    By Mentallic in forum C Programming
    Replies: 13
    Last Post: 03-21-2010, 07:44 AM
  3. new coder using Dev C++
    By newcoder3333 in forum C++ Programming
    Replies: 3
    Last Post: 07-29-2006, 06:35 PM
  4. HL2 mod needs coder
    By livewire in forum Projects and Job Recruitment
    Replies: 0
    Last Post: 07-30-2005, 11: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, 01:08 PM

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