Language QuickBasic
Date: | 04/20/05 |
Author: | Patrick Fleming |
URL: | n/a |
Comments: | 7 |
Info: | n/a |
Score: | (2.76 in 136 votes) |
'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
Andrew Bakke said on 01/13/06 20:47:51
It has been a while since I wrote in QBASIC, but I remember it's "advantage" over BASIC was it's shortcut terms.
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?
Jeff Dyer said on 07/28/06 17:00:10
Don't like the n = 100, then immediately subtract 1 from n at the start. The print n - 1 ; "bottles" bit is ugly as hell too ...
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
Andrew Blake said on 11/19/06 02:26:00
Just browsed on... The program does not take into account the last line of the song, no more beers on the wall... go to the store and buy some more!?! Little thing...
Ethan Lamoreaux said on 04/30/08 19:50:14
Andrew Bakke, this is not Qbasic but QuickBasic. They are not the same thing! QuickBasic comes with a compiler, Qbasic is only interpreted and does not support some of the language features of QuickBasic.
Marco Antonio Achury said on 07/30/08 00:14:38
When you type on qbasic editor "? a", as soon as you leave the line, the editor changes ? to PRINT. Also "print" is changed to "PRINT"
Scott Houdek said on 04/16/09 11:06:30
this version is more compact than the other one , the other looks like was done one a some other computer before there's was 16-bit processors.
barrym said on 07/16/10 06:16:50
Al Boulley's source is larger, but produces better output, and is more
entertaining to read, IMHO.