I want to put one small C-code in a textbox.
How shall I do it?
Printable View
I want to put one small C-code in a textbox.
How shall I do it?
Thanks but I could not make it work!
I want to put the following inside textbox.
I tried the following...Code:FindMincut(undirected graph G)
{
while there are more than 2 nodes in G do
{
pick an edge (u,v) at random in G;
contract the edge, while preserving multi-edges;
remove all loops;
}
output the remaining edges;
}
I am getting a page wide huge box around the text.Code:\begin{framed}
\begin{verbatim}
FindMincut(undirected graph G)
{
while there are more than 2 nodes in G do
{
pick an edge (u,v) at random in G;
contract the edge, while preserving multi-edges;
remove all loops;
}
output the remaining edges;
}
\end{verbatim}
\end{framed}
Can I make it smaller and more descent looking?
I want the boxes like this given in the PAGE-4 of the following PDF.
Code:http://www.cs.dartmouth.edu/~ac/Teach/CS105-Winter05/Handouts/05-mincut.pdf
Ok i have to admit it wasnt as easy as i thought, but after much googling i found it out:
Code:\documentclass[11pt,a4paper]{report}
\usepackage[pdftex]{graphicx}
\usepackage{fancyvrb}
\begin{document}
\begin{SaveVerbatim}{Code}
FindMincut(undirected graph G)
{
while there are more than 2 nodes in G do
{
pick an edge (u,v) at random in G;
contract the edge, while preserving multi-edges;
remove all loops;
}
output the remaining edges;
}
\end{SaveVerbatim}
\fbox
{
\begin{minipage}[t]{\textwidth}
\BUseVerbatim{Code}
\end{minipage}
}
\end{document}
Thanks for the help
But it is not showing as I wanted in the PDF as shown above in the link!