Thread: separate line

  1. #1
    Registered User
    Join Date
    Jun 2012
    Posts
    21

    separate line

    hello, i want to know how to separate the line because when i put my code between the code tag all code appear in the same line like this
    Code:
    int main(){printf("hello world");}

  2. #2
    Registered User
    Join Date
    May 2012
    Posts
    1,066
    You have to press enter after each line. So it should look like this in the message field:


    [code]
    int main(void)
    {
    printf("Hello world");
    }
    [/code]


    If you paste in the code you could try "Paste as plain text" (third icon in the first row in the enhanced message editor interface).

    Bye, Andreas

  3. #3
    Registered User
    Join Date
    Jun 2012
    Posts
    21
    thank you AndiPersti but even when i press enter after each line the code appear in the same line

  4. #4
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    Make sure you have javascript enabled (at least for cboard.cprogramming.com). Then check that the enter key on your keyboard works.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

  5. #5
    Registered User
    Join Date
    Jun 2012
    Posts
    21
    thank you grumpy but javascript enabled and the problem not solved

  6. #6
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Are you using Internet Explorer?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  7. #7
    Registered User
    Join Date
    Jun 2012
    Posts
    21
    I'm using google chrome

  8. #8
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Okay, are you writing your code in a separate text editor, or in the textarea input provided by the forum software? If you are using a separate text editor, what is it? What operating system are you using?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  9. #9
    Registered User
    Join Date
    Jun 2012
    Posts
    21
    I'm writing my code using textarea provided by the forum and i'm using linux ( debian)

  10. #10
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Very interesting. Could you use a separate text editor, then copy and paste here to see if it makes a difference? If it doesn't, change the line endings to Windows style and try again.

    Personally, I have never had a problem with posting multi-line code snippets here both on Windows 7 and various versions of Ubuntu Linux, but then I usually write my example code in a separate text editor (Geany).
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  11. #11
    Registered User
    Join Date
    Jun 2012
    Posts
    21
    using separate text editor it doesn't work and how i can change the line endings to windows style

  12. #12
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    2,158
    Don't mean to be a pest, but how do you know it doesn't work by copy-pasting from a text editor? I don't see another post with code since you asked, nor an edit indication.

  13. #13
    Registered User
    Join Date
    Jun 2012
    Posts
    21
    you can doing this with preview post

  14. #14
    Registered User
    Join Date
    May 2012
    Posts
    1,066
    Probably stupid question, but are you able to write text on different lines, like:

    Line 1
    Line 2
    Line 3

    If so, what happens if you put the code-tags one line above and below? Does the preview still show just one line?

    The reason for my question is that I've looked through some of your recent posts and you always write your messages in one long line. So show us that you can split your text into different lines.

    Bye, Andreas

  15. #15
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,613
    Quote Originally Posted by nadji View Post
    using separate text editor it doesn't work and how i can change the line endings to windows style
    Different answers for different software... Maybe it would help to define what Windows style is. Windows uses CRLF which means that lines end in the characters \r\n, and there may be a setting indicating that's how the file is written. Linux flavors just use \n for line endings in files.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 6
    Last Post: 06-07-2012, 02:50 AM
  2. Replies: 21
    Last Post: 08-07-2011, 09:55 PM
  3. Replies: 7
    Last Post: 12-13-2010, 02:13 PM
  4. Separate rotations
    By VirtualAce in forum Game Programming
    Replies: 3
    Last Post: 09-22-2004, 10:34 PM
  5. separate compilation
    By PutoAmo in forum C Programming
    Replies: 3
    Last Post: 04-02-2002, 09:29 AM