\documentclass[11pt,a4paper,dvips,oneside]{book}
\usepackage{geometry}
\usepackage{color}
\usepackage{alltt}
\usepackage{courier}
\usepackage{graphicx}
\usepackage[ansinew,latin1]{inputenc}
\usepackage{german}
\usepackage{framed}
\usepackage{amsmath,amssymb,amstext}
\usepackage[hang,scriptsize,bf]{caption}
\usepackage{subfigure}
\usepackage{pifont}
\usepackage{listings}
\lstset{ language=Delphi,
numbers=left,
numberstyle=\tiny,
stepnumber=1,
numbersep=9pt,
% backgroundcolor=\color{listingbackground},
basicstyle=\scriptsize,
captionpos=b,
breaklines=true,
breakindent=20pt,
texcl=true,
% mathescape=true,
escapechar=•, % ASCI Char #263 (als ALT+263 auf dem Numpad eingeben)
xleftmargin=0pt,
% escapebegin=$,
% escapeend=$,
extendedchars=true,
float=false,
frame=none,
rulesepcolor=\color{black},
rulesep=2pt,
framesep=3pt,
framexleftmargin=3pt,
framexrightmargin=3pt,
columns=[c]fixed,
basewidth={0.6em,0.45em},
fontadjust=false
}
\begin{document}
\begin{lstlisting}[language=Delphi,caption={[Main]Main},label={qc_main}]
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
txtb: TEdit;
Label2: TLabel;
txtc: TEdit;
Button1: TButton;
lbla: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
uses math ;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
a, b, c : double ;
begin
b := StrToFloat(txtb.text) ;
c := StrToFloat(txtc.text) ;
{ •$a=\sqrt{b^2+c^2}$• }
a := sqrt(Power(b,2)+Power(c,2)) ;
lbla.caption := Format ('a= %.2f',[a]) ;
end;
end.
\end{lstlisting}
\end{document}