There are two ways, one is a simple method which is best suited for beginners(like me) and the other is the advancedmethod which gives your code box a more professional look but requires a little source tweaking.
So here's the simple method, just paste this code on your post editor in Edit HTML tab.
<textarea name="textarea" cols="40" rows="4" wrap="VIRTUAL">
YOUR CODE
</textarea>
Here's an image on where to post the code: