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 D

Date:04/20/05
Author:Philipp Winterberg
URL:http://www.winterbergs.de/
Comments:7
Info:http://www.digitalmars.com/d/index.html
Score: (2.14 in 42 votes)
// D version of 99 Bottles of beer (Bottles.d)
// (http://www.digitalmars.com/d/index.html).
// Philipp Winterberg, http://www.winterbergs.de

int main()
{
    for (int b = 99; b > 0; b--) 
    {
        printf("%d bottle(s) of beer on the wall,\n", b);
        printf("%d bottle(s) of beer.\n", b);
        printf("Take one down, pass it around,\n");
        printf("%d bottle(s) of beer on the wall.\n\n", (b-1));
    }
    return 0;
}

Download Source | Write Comment

Alternative Versions

VersionAuthorDateCommentsRate
1Stewart Gordon05/31/054
D feuture's galoreFredrik Olsson10/09/052
Template metaprogrammingDon Clugston07/11/061
Fiber "Ring"Bryan Knowles11/17/100
Div Operator Editionbadmadevil02/29/080

Comments

>>  Paul Smirnov said on 06/28/05 09:06:36

Paul Smirnov Any D language specifics here? I didn't catch difference from C/C++.

>>  Yakov Smirnoff said on 07/13/05 22:31:11

Yakov Smirnoff Does anyone actually use this language?

>>  Ian Osgood said on 07/14/05 17:19:01

Ian Osgood D is like C++ with many warts removed and lots of built-in libraries and modules. There are better examples at the Great Computer Language Shootout:
http://shootout.alioth.debian.org/great/

>>  Hasan said on 07/28/05 07:47:37

Hasan Just go to the website, the main part of the site is the reference pages.

>>  Bau de jogos said on 11/24/06 13:50:39

Bau de jogos another wrong code :(

>>  Mitu said on 09/29/09 15:03:33

Mitu Needs to be updated:

1. writef, not printf
2. import std.stdio; missing.

>>  barrym said on 03/29/10 05:11:16

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: