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:01/26/07
Author:Null1024
URL:n/a
Comments:1
Info:n/a
Score: (2.11 in 9 votes)
'99 Bottles of Beer in D++
'App by Null1024
'Get D++ at www.pagemac.com

newvar beer;

function main()
{
for beer = 99 to 1 step -1;

  if beer > 1 then
    screenout beer & " bottles of beer on the wall,"; screen;
    screenout beer & " bottles of beer,"; screen;
    screenout "Take one down, pass it around,"; screen;
    screenput beer & " bottles of beer on the wall,"; screen; screen;
  endif

  if beer = 1 then
    screenout "1 bottle of beer on the wall,"; screen;
    screenout "1 bottle of beer,"; screen;
    screenout "Take one down, pass it around,"; screen;
    screenput "1 bottle of beer on the wall,"; screen; screen;
  endif;

next beer;
screenput "We need more beer."; screen;
pak;
end;
}

Download Source | Write Comment

Alternative Versions

Comments

>>  ronnzo said on 06/11/08 17:19:17

ronnzo written without having used brain! the program costs a lot of memory and works as slow as possible. so if you decide to spend memory you should make it run faster at least. run the for-loop down until 2 and put the loop end between the 2 if blocks. then delete both 'if' and 'endif' lines to do the screenout only. This is a very simple and cheap performance enhancement and a big number of applications might run faster, if every programmer would try to think about this

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: