Language BASIC
| Date: | 05/27/05 |
| Author: | M. Eric Carr |
| URL: | n/a |
| Comments: | 11 |
| Info: | n/a |
| Score: |
10 REM Basic version of 99 bottles of beer 20 REM Modified by M. Eric Carr (eric@carrnet.net) 30 REM from prior version found on this site. 40 REM (Modified to correct "1 bottle" grammar) 50 FOR X=99 TO 1 STEP -1 60 PRINT X;"bottle"; 70 IF X<>1 THEN PRINT "s"; 80 PRINT " of beer on the wall,";X;"bottle"; 90 IF X<>1 THEN PRINT "s"; 100 PRINT " of beer" 110 PRINT "Take one down and pass it around," 120 PRINT X-1;"bottle"; 130 IF X<>1 THEN PRINT "s"; 140 PRINT " of beer on the wall" 150 NEXT
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
This particular code looks way too much like something I'd have written for this, too. Argh. Flashbacks.
130 IF X<>1 THEN PRINT "s";
Sorry 'bout that. Good catch.
...and yes, it would be more universal to write
150 NEXT X
--Eric
10 REM Basic version of 99 bottles of beer
20 REM Modified by Mike Daugherty
30 REM from prior version found on this site.
40 REM (Modified to add print subroutine)
50 t1$="bottle":t2$=" of beer on the wall,":t3$=" of beer"
60 t4$="Take one down and pass it around,"
70 FOR X=99 TO 1 STEP -1
80 PRINT X;t1$;
90 GOSUB 200
100 PRINT t2$;X;t1$;
110 GOSUB 200
120 PRINT t3$
130 PRINT t4$
140 PRINT X-1;t1$;
150 GOSUB 200
160 PRINT t2$
170 NEXT
180 END
190 REM PLURAL
200 IF X <> 1 THEN PRINT "s";
210 RETURN
So it doesn't factorize so easily.
Either way, that program doesn't print the reference lyrics.
go to the store, buy some more..."
20 FOR X=99 TO 0 STEP -1
30 ProcStr$=X;"bottles of beer"
40 IF X=1 THEN ProcStr$="1 bottle of beer"
50 IF X=0 THEN ProcStr$="No more bottles of beer"
60 IF X<>99 THEN "Take one down and pass it around,";ProcStr$;"on the wall."
70 PRINT ProcStr$;"on the wall,";ProcStr$;"."
80 NEXT X
90 PRINT "Go to the store and buy some more, 99 bottles of beer on the wall."
You assclown, this is rubbish im dissapinted in you sonny jim. Please Note:THIS IS FAKE
Some BASIC doesn't support "long" variable and only supporte one char variable...