| @@ -1,6 +1,7 @@ | |||||
| \documentclass[uebung]{../../../lecture} | \documentclass[uebung]{../../../lecture} | ||||
| \usepackage{listings} | \usepackage{listings} | ||||
| \usetikzlibrary{positioning} | |||||
| \title{Übungsblatt 6} | \title{Übungsblatt 6} | ||||
| \author{Samuel Weidemaier, Christian Merten} | \author{Samuel Weidemaier, Christian Merten} | ||||
| @@ -27,14 +28,190 @@ | |||||
| \lstset{style=mystyle} | \lstset{style=mystyle} | ||||
| \usepackage{tikz, wasysym} | |||||
| \usetikzlibrary{automata, positioning, arrows,shapes,shadows} | |||||
| \tikzstyle{abstract}=[rectangle, draw=black, | |||||
| %text centered, | |||||
| anchor=north, text=black, text width=15cm, rounded corners] | |||||
| \tikzstyle{subgroup}=[rectangle, draw=blue, | |||||
| %text centered, | |||||
| anchor=north, text=black, text width=3.5cm, rounded corners] | |||||
| \tikzstyle{myarrow}=[->, >=stealth, thick] | |||||
| \tikzstyle{gestrichen}=[->, >=stealth, dashed] | |||||
| \begin{document} | \begin{document} | ||||
| \punkte | \punkte | ||||
| \begin{aufgabe} | \begin{aufgabe} | ||||
| siehe Blatt. | |||||
| \vspace{5mm} | |||||
| Marker 1: | |||||
| \vspace{-3mm} | |||||
| \begin{center} | |||||
| \begin{tikzpicture}[shorten >= 1pt, node distance=2.5cm, on grid, auto] | |||||
| \node[abstract, rectangle split, rectangle split parts=2] (global) { | |||||
| Globale Umgebung | |||||
| \nodepart{second}$g$ int $1$ | |||||
| }; | |||||
| \node[subgroup, rectangle split, rectangle split parts=2, below left of=global, xshift=-3.3cm, yshift=-0.3cm] (main) { | |||||
| main() \\ | |||||
| \nodepart{second} | |||||
| $a$ int $2$ \\ | |||||
| $b$ int $14$ | |||||
| }; | |||||
| \node[subgroup, rectangle split, rectangle split parts=2, below right of=main, yshift=-0.4cm] (block1) { | |||||
| Block $1$ in main() \\ | |||||
| \nodepart{second} | |||||
| $a$ int $7$ \\ | |||||
| $g$ int $?$ | |||||
| }; | |||||
| \node[subgroup, rectangle split, rectangle split parts=2, right of=block1, , xshift=2.1cm, yshift=-0.32cm] (ggTab) { | |||||
| ggT(b, a) \\ | |||||
| \nodepart{second} | |||||
| $a$ int $14$ \\ | |||||
| $b$ int $7$ \\ | |||||
| Null int $0$ | |||||
| }; | |||||
| \node[subgroup, rectangle split, rectangle split parts=2, below right of=ggTab, yshift=-0.7cm] (amodb) { | |||||
| $a \text{ mod } b(a,b)$ \\ | |||||
| \nodepart{second} | |||||
| $a$ int $14$ \\ | |||||
| $b$ int $7$ \\ | |||||
| $m$ int $0$ | |||||
| }; | |||||
| \draw[myarrow] (main.west) -- ++(0,0) -| ([xshift=-7.2cm] global.south); | |||||
| \draw[myarrow] (block1.west) -- ++(0,0) -| ([xshift=-1cm] main.south); | |||||
| \draw[gestrichen] ([xshift=-1.4cm] ggTab.south) -- ++(0,-0.4) -| (block1.south); | |||||
| \draw[myarrow] (ggTab.west) -- ++(0,0) -| ([xshift=-1cm] global.south); | |||||
| \draw[gestrichen] (amodb.west) -- ++(0,0) -| ([xshift=-1.7cm] ggTab); | |||||
| \draw[myarrow] ([xshift=1cm] amodb.north) -- ++(0,0) -| ([xshift=4.1cm] global.south); | |||||
| \end{tikzpicture} | |||||
| \vspace{-10mm} | |||||
| \end{center} | |||||
| \nopagebreak | |||||
| Marker 2: | |||||
| \vspace{-2mm} | |||||
| \begin{center} | |||||
| \begin{tikzpicture}[shorten >= 1pt, node distance=2.5cm, on grid, auto] | |||||
| \node[abstract, rectangle split, rectangle split parts=2] (global) { | |||||
| Globale Umgebung | |||||
| \nodepart{second}$g$ int $2$ | |||||
| }; | |||||
| \node[subgroup, rectangle split, rectangle split parts=2, below left of=global, xshift=-3.3cm, yshift=-0.3cm] (main) { | |||||
| main() \\ | |||||
| \nodepart{second} | |||||
| $a$ int $2$ \\ | |||||
| $b$ int $14$ | |||||
| }; | |||||
| \node[subgroup, rectangle split, rectangle split parts=2, below right of=main, yshift=-0.4cm] (block1) { | |||||
| Block $1$ in main() \\ | |||||
| \nodepart{second} | |||||
| $a$ int $7$ \\ | |||||
| $g$ int $?$ | |||||
| }; | |||||
| \node[subgroup, rectangle split, rectangle split parts=2, right of=block1, , xshift=2.1cm, yshift=-0.32cm] (ggTab) { | |||||
| ggT(b, a) \\ | |||||
| \nodepart{second} | |||||
| $a$ int $14$ \\ | |||||
| $b$ int $7$ \\ | |||||
| Null int $0$ | |||||
| }; | |||||
| \node[subgroup, rectangle split, rectangle split parts=2, below right of=ggTab, , xshift=1cm, yshift=-0.7cm] (ggTmod) { | |||||
| $ggT(b, a \text{ mod }b(a,b))$ \\ | |||||
| \nodepart{second} | |||||
| $a$ int $7$ \\ | |||||
| $b$ int $0$ \\ | |||||
| Null int $0$ | |||||
| }; | |||||
| \draw[myarrow] (main.west) -- ++(0,0) -| ([xshift=-7.2cm] global.south); | |||||
| \draw[myarrow] (block1.west) -- ++(0,0) -| ([xshift=-1cm] main.south); | |||||
| \draw[gestrichen] ([xshift=-1.4cm] ggTab.south) -- ++(0,-0.4) -| (block1.south); | |||||
| \draw[myarrow] (ggTab.west) -- ++(0,0) -| ([xshift=-1cm] global.south); | |||||
| \draw[gestrichen] (ggTmod.west) -- ++(0,0) -| (ggTab.south); | |||||
| \draw[myarrow] (ggTmod.north) -- ++(0,0) -| ([xshift=4.1cm] global.south); | |||||
| \end{tikzpicture} | |||||
| \end{center} | |||||
| Marker 3: | |||||
| \begin{center} | |||||
| \begin{tikzpicture}[shorten >= 1pt, node distance=2.5cm, on grid, auto] | |||||
| \node[abstract, rectangle split, rectangle split parts=2] (global) { | |||||
| Globale Umgebung | |||||
| \nodepart{second}$g$ int $2$ | |||||
| }; | |||||
| \node[subgroup, rectangle split, rectangle split parts=2, below left of=global, xshift=-3.3cm, yshift=-0.3cm] (main) { | |||||
| main() \\ | |||||
| \nodepart{second} | |||||
| $a$ int $2$ \\ | |||||
| $b$ int $7$ | |||||
| }; | |||||
| \draw[myarrow] (main.west) -- ++(0,0) -| ([xshift=-7.2cm] global.south); | |||||
| \end{tikzpicture} | |||||
| \end{center} | |||||
| \end{aufgabe} | \end{aufgabe} | ||||
| \newpage | |||||
| \begin{aufgabe} Primfaktorzerlegung | \begin{aufgabe} Primfaktorzerlegung | ||||
| \begin{lstlisting}[language=C++, title=Primfaktorzerlegung, captionpos=b] | \begin{lstlisting}[language=C++, title=Primfaktorzerlegung, captionpos=b] | ||||
| #include "cpp_headers/fcpp.hh" | #include "cpp_headers/fcpp.hh" | ||||