Language GNU Desk Calculator
| Date: | 04/20/05 |
| Author: | Anonymous |
| URL: | n/a |
| Comments: | 1 |
| Info: | n/a |
| Score: |
dc is the Desk Calculator for *nix; It works on reverse polish
notation, and a few other commands. The output of this routine
is a little jagged, as dc has no commands to control screen formatting.
Usage: dc 99bottles
where this source file is saved as 99bottles
NB: A blank line is required at the end of the file
Without it, dc will not quit.
<PRE>
[ bottles of beer on the wall
]sa
[ bottles of beer
]sb
[ take one down, pass it around
]sc
[
]sd
99sn
[lalnpsnPlblnp1-snPlcPlalnpsnPldPln0<x]sx
lxx
q
Download Source | Write Comment
Download Source | Write Comment
Add Comment
Please provide a value for the fields Name,
Comment and Security Code.
This is a gravatar-friendly website.
E-mail addresses will never be shown.
Enter your e-mail address to use your gravatar.
Please don't post large portions of code here! Use the form to submit new examples or updates instead!
Comments
sub-optimal output; I prefer my version (of course):
[[s]n]ss[[ bottle]n1ln!=s[ of beer]n]sb[ on the wall]sw[, ]sc[.]sp[2Q]sq[lnnlbx
lwnlcnlnnlbxlpp[Take one down, pass it around; ]nln1-sn0ln=qlnnlbxlwnlpplxx]sx
99snlxx[no more]nlbxlwnlpp
Or, somewhat less obfuscated:
[[s]n]ss
[[ bottle]n 1ln!=s [ of beer]n]sb
[ on the wall]sw
[, ]sc
[.]sp
[2Q]sq
[lnn lbx lwn lcn lnn lbx lpp
[Take one down, pass it around; ]n
ln1-sn 0ln=q lnn lbx lwn lpp lxx]sx
99sn lxx
[no more]n lbx lwn lpp
-Zak