]]>Most code that is going to be posted on the site is going to be a short snippet where the relevant parts are the only ones going to be posted. Anything that gets a little longer will usually have comments in relevant parts explaining what's going on. We're programmers, I think that suffices. Allowing lines might encourage bigger code blocks, and that's not a behavior I think we want to encourage.
I agree that long chunks of code shouldn't be disallowed but I also agree with Michael that there should be something in the "how to ask" page asking people to describe their algorithms in higher level terms, rather than in code. Perhaps it's just me but I couldn't write c++ code if my life depended on it, without investing some time in learning the syntax. However I'm well capable of following the reasoning behind an algorithm, and could possibly be of help to OP's if they wrote in higher-level terms rather then code.
If a question really is about the maths behind an algorithm, then that's fine and the question should be written in terms understandable to a lot of mathematicians. If however the question is sensitive tot which programming language it is written in, then it probably is not an MO question.
]]>I'm having trouble finding other examples, but I know there have been other such posts. Generally I think that many of us aren't willing to read large amounts of code, especially in unfamiliar languages. (C++ is hardly obscure, but I'm not a programmer.)
Perhaps the "how to ask" page should include something like "if your post includes lots of code, this probably isn't the right place for it?" This seems to be in keeping with the general mathematical ethos that papers don't include code (at least, not outside of an appendix); most "experimental" papers that I've read seem to include a high-level description of the algorithm, maybe even in pseudocode, but not something somebody could actually run.
]]>