Voting

Category

real language

Bookmarking

Del.icio.us Digg Diigo DZone Earthlink Google Kick.ie
Windows Live LookLater Ma.gnolia Reddit Rojo StumbleUpon Technorati

Language C--

Date:04/20/05
Author:Philipp Winterberg
URL:http://www.winterbergs.de/
Comments:8
Info:n/a
Score: (2.91 in 135 votes)
/* 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

Alternative Versions

Comments

>>  Honk said on 06/28/05 08:41:07

Honk Is this another method of faking C++?

>>  BigZaphod said on 06/28/05 22:47:17

BigZaphod C-- is actually sort of lower level than C. It isn't a fake language if that is what you were getting at. Check out the URL mentioned in the comments in the source code and you'll see it is not only legit, but also has been around awhile.

>>  cheese said on 06/07/08 06:54:29

cheese Why do you declare 'b' globally? Why not inside the main function?

>>  WizardNumberNext said on 08/20/08 13:42:59

WizardNumberNext Why do you declare 'b' globally? Why not inside the main function?

Yes! Why?
This is ugliest way to declare var which will be used only by one algo

>>  Rabbit said on 04/30/09 09:35:05

Rabbit int b;
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) :)

>>  NerdBoy3000 said on 08/19/09 04:57:29

NerdBoy3000 "Why do you declare 'b' globally? Why not inside the main function?"

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.

>>  Jerry said on 09/12/09 09:56:50

Jerry 'b' is _declared_ globally, but it is set in main().

>>  barrym said on 03/29/10 05:47:47

barrym More lazy-ass "bottle(s)" code. C'mon Phil, give us a conditional
expression or two. Geez Louise..........

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!

Name:

eMail:

URL:

Security Code:
  
Comment: