Advertisement
wilk_maciej

5_5

May 10th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Latex 1.81 KB | None | 0 0
  1. \documentclass{standalone}
  2. \usepackage[T1]{fontenc}
  3. \usepackage[latin2]{inputenc}
  4. \usepackage[english]{babel}
  5. \usepackage{tikz}
  6. \usetikzlibrary{calc,through,backgrounds,positioning,fit}
  7. \usetikzlibrary{shapes,arrows,shadows}
  8.  
  9. \begin{document}
  10.  
  11. \begin{tikzpicture}[auto,
  12. decision/.style = {diamond, draw=blue, thick, fill=blue!20, text width=1.5cm,
  13.                   align=flush center, inner sep=1pt},
  14. block/.style = {rectangle, draw=blue, thick, fill=blue!20, text width=2cm,
  15.                align=center, minimum height=1.3cm},
  16. start/.style = {draw=red, thick, ellipse, fill=red!20, minimum height=8mm},
  17. inout/.style = {draw=green!60!black, thick, fill=green!20, trapezium, trapezium left angle=80,
  18.                trapezium right angle=-80, minimum height=10mm, text width=1cm, align=center,
  19.                inner sep=1pt},
  20. line/.style ={draw, thick, -latex}]
  21.  
  22. \matrix[column sep=5mm,row sep=7mm]
  23. {
  24. % row 1
  25. &&& \node [start] (start) {start}; &&& \\
  26. % row 2
  27. &&& \node [inout] (read) {read($a, b$)}; &&& \\
  28.  
  29. % row 4
  30. &&& \node [decision] (decide1) {$a = b$}; &&& \\
  31. % row 5
  32. &&\node [decision] (decide) {$a < b$}; &&&
  33. &&&\node [inout] (write) {write($a$)}; \\
  34. % row 6
  35. \node[block] (update1) {$a = a-b$};&&&
  36. \node[block] (update) {$b = b-a$};&&&
  37. &&\node [start] (stop) {stop}; \\
  38. % row
  39. };
  40.  
  41. \begin{scope}[every path/.style=line]
  42. \path(start) -- (read);
  43. \path(read) -- (decide1);
  44. \path(decide1)  -| node [near start] {$no$} (decide);
  45. \path(decide1)  -| node [near start] {$yes$} (write);
  46. \path(decide)  -| node [near start] {$no$} (update1);
  47. \path(decide)  -| node [near start] {$yes$} (update);
  48. \path(write) -- (stop);
  49. \path (update1.south) |- ++(-1.5,-1) coordinate(A) |- ($ (decide1.north) + (0,0.4) $) coordinate(B);
  50. \path (update.south) |- (A) |- (B);
  51. \end{scope}
  52. \end{tikzpicture}
  53. \end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement