Hi all.

I have a website that I'd like to post my C++ endeavours to. I want to make it so the source code can be viewed on my website with the correct colour coding, etc.
I'm relatively new to CSS and XHTML. I've been using Notepad++.
How do I go about doing this?

Thanks in advance for any help offered.

The most basic solution is to wrap the code in pre tags to preserve the formatting. But be careful with C++, because you'll need to remember to escape certain characters like angle brackets and the & operators, otherwise they'll be stripped when the browser can't interpret them as HTML. It's annoying looking at naively posted code and seeing #include with the actual header missing. ;)

You could also wrap the code in HTML code tags. I'm not sure off the top of my head if that will fix the stripping problem or not though, it's something to test.

If you need highlighting as well then there are a number of syntax highlighting options out there such as Google Code Prettify or SyntaxHighlighter.

Great :)
Thanks deceptikon. I'll give that a go.

If you are using php as your web language then you can use the PHP’s built-in highlighter.

for more detailed article on this you can visit following URL :
Highlight Source Code

Thanks thewebhostingdi. I may do so in the future so I'll bear it mind. Cheers.