separate line

This is a discussion on separate line within the General Discussions forums, part of the Community Boards category; hello, i want to know how to separate the line because when i put my code between the code tag ...

  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,255
    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%.

  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
    21,604
    Are you using Internet Explorer?
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    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
    21,604
    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?
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    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
    21,604
    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).
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    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
    1,605
    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.
    A class that doesn't overload all operators just isn't finished yet. -- SmugCeePlusPlusWeenie
    A year spent in artificial intelligence is enough to make one believe in God. -- Alan J. Perlis

  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
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,661
    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, 01: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, 08:29 AM

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