Here are some methods (including the listing package already shown by percusse):
\documentclass[journal,a4paper]{IEEEtran}
\usepackage{listings}
\usepackage{fancyvrb}
\usepackage{framed}
\begin{document}
\title{How to insert framed code}
\author{Me}
\maketitle
% The Abstract
\begin{abstract}
The article shows some methods to framed code.
\end{abstract}
% The Keywords
\begin{IEEEkeywords}
Code, framed, boxes.
\end{IEEEkeywords}
\section{Framed code}
\subsection{Using listings}
\begin{lstlisting}[frame=single]
for i:=maxint to 0 do
begin
{ do nothing }
end;
\end{lstlisting}
\subsection{Using fancyvrb}
\begin{Verbatim}[frame=single]
for i:=maxint to 0 do
begin
{ do nothing }
end;
\end{Verbatim}
\subsection{Using framed+verbatim}
\begin{framed}
\begin{verbatim}
for i:=maxint to 0 do
begin
{ do nothing }
end;
\end{verbatim}
\end{framed}
\end{document}
