Language C--
Date: | 04/20/05 |
Author: | Philipp Winterberg |
URL: | http://www.winterbergs.de/ |
Comments: | 8 |
Info: | n/a |
Score: | ![]() |
/* C-- version of 99 Bottles of beer (Bottles.c--) */ /* See http://www.cs.utexas.edu/users/tbone/c--/ */ /* Philipp Winterberg, http://www.winterbergs.de */ ? include "WRITE.H--" int b; main () { b = 99; do { WRITEINT(b); WRITESTR(" bottle(s) of beer on the wall,\n"); WRITEINT(b); WRITESTR(" bottle(s) of beer.\n"); WRITESTR("Take one down, pass it around,\n"); b--; WRITEINT(b); WRITESTR(" bottle(s) of beer on the wall.\n\n"); } while (b > 0); }
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
Yes! Why?
This is ugliest way to declare var which will be used only by one algo
main ()
{
b = 99;
do {
WRITEINT(b);
WRITESTR(" bottles of beer on the wall,\n"
WRITEINT(b);
WRITESTR(" bottles of beer.\n"
WRITESTR("Take one down, pass it around,\n"
b--;
WRITEINT(b);
WRITESTR(" bottles of beer on the wall.\n\n"
} while (b > 2);
WRITEINT(b);
WRITESTR(" bottles of beer on the wall,\n"
WRITEINT(b);
WRITESTR(" bottles of beer.\n"
WRITESTR("Take one down, pass it around,\n"
b--;
WRITEINT(b);
WRITESTR(" bottle of beer on the wall.\n\n"
WRITEINT(b);
WRITESTR(" bottle of beer on the wall,\n"
WRITEINT(b);
WRITESTR(" bottle of beer.\n"
WRITESTR("Take one down, pass it around,\n"
b--;
WRITEINT(b);
WRITESTR("no bottle of beer on the wall.\n\n"
}
this code is bigest, but it return the original text of this song (of course, if i'm not forget this text)
It IS inside the main function. You mean inside the do loop in the main function xD
but yes, I agree that that is a terrible way to code.
expression or two. Geez Louise..........