How to format code for IEEE Journals I'm working on a paper for IEEE Transactions on Computers, and I can't find any guidelines on how to format code (C++) that is included in the paper.

I found some other papers with short code snippets, and it looks like they just used Courier New for the font, but I'm not sure of the font size. Do I need to include line numbers? I haven't found any with long sections of code (so for something with 4 lines I wouldn't expect line numbers anyways).

If someone has published a paper with code in it in IEEE Trans, and could give me some advice, I would really really appreciate it.
The IEEE does not generally have any strict guidelines on how to format code for papers in their journals or conferences, so you have some freedom of choice in how you do so.  The general guideline is simply to use a monospace font and formatting choices that are not blatantly incompatible with the rest of the paper.

Now, if you are writing for IEEE, you should probably be using LaTeX.  This means that there are a number of excellent packages, such as these, that will format your code in a nice and professional manner that is generally quite familiar to IEEE reviewers and editors.  If you pick one and use that, you should not expect any problems.