capitalex hat die Gist bearbeitet 10 months ago. Zu Änderung gehen
1 file changed, 32 insertions
hypot.poqs(Datei erstellt)
| @@ -0,0 +1,32 @@ | |||
| 1 | + | { [#port] [@add (x) and (y) into (where)] => | |
| 2 | + | [% push(vars.where, vars.x + vars.y) %] } | |
| 3 | + | ||
| 4 | + | { [#port] [@square root of (x) into (where)] => | |
| 5 | + | [% push(vars.where, math.sqrt(vars.x)) %] } | |
| 6 | + | ||
| 7 | + | { [#port] [@write (mesage)] => | |
| 8 | + | [% io.write(vars.message) %] } | |
| 9 | + | ||
| 10 | + | { [hypotenuse of (a) and (b)] => | |
| 11 | + | [@square of (a) into {a square is *}] | |
| 12 | + | [@square of (b) into {b square is *}] } | |
| 13 | + | ||
| 14 | + | { [a squared is (a)] [b squared is (b)] => | |
| 15 | + | [@add (a) and (b) into {a squared plus b squared is *}] } | |
| 16 | + | ||
| 17 | + | { [a squared plus b squared is (c squared)] => | |
| 18 | + | [@square root of (c squared) into {hypotenuse is *}] } | |
| 19 | + | ||
| 20 | + | { [show results] [hypotenuse is (c)] => | |
| 21 | + | [@write "The hypotenuse is "] | |
| 22 | + | [@write (c)] | |
| 23 | + | [@write "\n"] | |
| 24 | + | [show results] } | |
| 25 | + | ||
| 26 | + | { [show results} => } | |
| 27 | + | ||
| 28 | + | { => | |
| 29 | + | [hypotenuse of #3 and #4] | |
| 30 | + | [hypotenuse of #5 and #12] | |
| 31 | + | [hypotenuse of #8 and #15] | |
| 32 | + | [show results] } | |
Neuer
Älter