Language QuickBasic
Date: | 04/20/05 |
Author: | Patrick Fleming |
URL: | n/a |
Comments: | 7 |
Info: | n/a |
Score: | ![]() |
'99 Bottles of Beer on the Wall 'Patrick Fleming http://chem-www.mps.ohio-state.edu/~pfleming/ CLS n = 100 DO UNTIL n = 1 n = n - 1 PRINT n; "bottle"; IF n <> 1 THEN PRINT "s"; PRINT " of beer on the wall . . ." PRINT n; "bottle"; IF n <> 1 THEN PRINT "s"; PRINT " of beer!" PRINT "Take one down, pass it around . . ." PRINT n - 1; "bottle"; IF n - 1 <> 1 THEN PRINT "s"; PRINT " of beer on the wall!" PRINT LOOP END
Download Source | Write Comment
Alternative Versions
Version | Author | Date | Comments | Rate |
---|---|---|---|---|
boolean algebra, "four phrase" logic | Al Boulley | 01/19/08 | 1 | ![]() ![]() |
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
Ie, the symbol '?' can be used in place of 'PRINT', shortening the code's character length and making it look more like QBASIC. I know there are other shortcuts, so maybe someone who still has a QBASIC compiler could check this out?
Neater would be
CLS
n = 99
DO UNTIL n = 1
PRINT n; "bottle";
IF n <> 1 THEN PRINT "s";
PRINT " of beer on the wall . . ."
PRINT n; "bottle";
IF n <> 1 THEN PRINT "s";
PRINT " of beer!"
PRINT "Take one down, pass it around . . ."
n = n - 1
PRINT n; "bottle";
IF n <> 1 THEN PRINT "s";
PRINT " of beer on the wall!"
PRINT
LOOP
entertaining to read, IMHO.