How to add code to the post?

Hi there, I am new to the forums and this site, how can I add a code that I have in C++?
Welcome, and thanks for asking.

The site features some custom BBCode tags, namely the code tag (which I can't type here, because I don't have a convenient way to type zero width space on this computer).

In the beginner forum, these are provided for you in the message. In all other forums, you'll need to type them yourself. You can insert them at the cursor's position or highlight any selected text by pressing the <> button in the format box below the content box of the new thread form, or to the right of the content box of a new reply form. The advantage of this is that it will syntax highlight the code you've provided and give us line numbers for easy referencing.

Demonstration of code tags:
1
2
3
4
5
6
7
#include <iostream>
int main() {
    std::cout << "Do not try to greet the world. That's impossible.\n"
                  << "Instead, only try to realize the truth.\n"
                  << "There is no world." << std::endl;
    return 0;
}


Should your code be particularly long, or if you have multiple medium-sized files you'd like to show, you can use a paste service such as http://ideone.com or http://pastebin.com (or some other related service). Remember to select which language you're using.

Happy programming!
-Albatross
Last edited on
Topic archived. No new replies allowed.