If you want to write an algorithm, see Write pseudo code in latex.
Here's an excerpt
\documentclass{article}
\usepackage{algorithm}
\usepackage{algpseudocode}
\begin{document}
\begin{algorithm}
\caption{An algorithm}\label{alg:myalgo}
\begin{algorithmic}
\State Hello!
\end{algorithmic}
\end{algorithm}
\end{document}

If you want your figures to have that style, load the float package and issue:
\floatstyle{ruled}
\restylefloat{figure}
MWE:
\documentclass{article}
\usepackage{graphicx}
\usepackage{float}
\floatstyle{ruled}
\restylefloat{figure}
\begin{document}
\begin{figure}
\centering
\includegraphics[width=2cm]{example-image}
\caption{A figure}\label{fig:myfig}
\end{figure}
\end{document}

algorithmandalgorithmicxpackages. See this answer of mine: http://tex.stackexchange.com/a/163779/27635 – karlkoeller Mar 17 '15 at 12:09