Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- \documentclass{standalone}
- \usepackage[T1]{fontenc}
- \usepackage[latin2]{inputenc}
- \usepackage[english]{babel}
- \usepackage{tikz}
- \usetikzlibrary{calc,through,backgrounds,positioning,fit}
- \usetikzlibrary{shapes,arrows,shadows}
- \begin{document}
- \begin{tikzpicture}[auto,
- decision/.style = {diamond, draw=blue, thick, fill=blue!20, text width=1.5cm,
- align=flush center, inner sep=1pt},
- block/.style = {rectangle, draw=blue, thick, fill=blue!20, text width=2cm,
- align=center, minimum height=1.3cm},
- start/.style = {draw=red, thick, ellipse, fill=red!20, minimum height=8mm},
- inout/.style = {draw=green!60!black, thick, fill=green!20, trapezium, trapezium left angle=80,
- trapezium right angle=-80, minimum height=10mm, text width=1cm, align=center,
- inner sep=1pt},
- line/.style ={draw, thick, -latex}]
- \matrix[column sep=5mm,row sep=7mm]
- {
- % row 1
- &&& \node [start] (start) {start}; &&& \\
- % row 2
- &&& \node [inout] (read) {read($a, b$)}; &&& \\
- % row 4
- &&& \node [decision] (decide1) {$a = b$}; &&& \\
- % row 5
- &&\node [decision] (decide) {$a < b$}; &&&
- &&&\node [inout] (write) {write($a$)}; \\
- % row 6
- \node[block] (update1) {$a = a-b$};&&&
- \node[block] (update) {$b = b-a$};&&&
- &&\node [start] (stop) {stop}; \\
- % row
- };
- \begin{scope}[every path/.style=line]
- \path(start) -- (read);
- \path(read) -- (decide1);
- \path(decide1) -| node [near start] {$no$} (decide);
- \path(decide1) -| node [near start] {$yes$} (write);
- \path(decide) -| node [near start] {$no$} (update1);
- \path(decide) -| node [near start] {$yes$} (update);
- \path(write) -- (stop);
- \path (update1.south) |- ++(-1.5,-1) coordinate(A) |- ($ (decide1.north) + (0,0.4) $) coordinate(B);
- \path (update.south) |- (A) |- (B);
- \end{scope}
- \end{tikzpicture}
- \end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement