Little Help

This is a discussion on Little Help within the C Programming forums, part of the General Programming Boards category; My while loop is messed up too, trying to figure out how I can set it up logically and not ...

  1. #16
    Registered User
    Join Date
    Oct 2012
    Posts
    126
    My while loop is messed up too, trying to figure out how I can set it up logically and not getting anywhere

  2. #17
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Why not use the intuitive for loop as I showed you? When you have a CERTAIN number you need to stop at, a for loop is just the clearer choice. When you have an unknown number of loops to make, then a while loop seems quite natural, and a better choice.

  3. #18
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,308
    This line wont do what you think:
    Code:
    printf("//|   |\\   |\n");
    Backslash is the escape character, which is used for things such as \n to do a newline etc.
    This means the above gives you one backslash, not two. You'll want to use this to get two backslashes:
    Code:
    printf("//|   |\\\\   |\n");
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

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