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 IDC

(IDA Pro Script)

Date:12/18/07
Author:Tim Vidas
URL:n/a
Comments:0
Info:http://www.datarescue.com/idabase/idaclike.htm
Score: (2.90 in 10 votes)
//IDC (IDA Pro) version of 99 bottles of beer on the wall
//Tim Vidas 2007

static main(){
  auto beers;
  beers=99;
  while((beers = verse(beers))>=0);
}

static verse(b){
  Message("%s of beer on the wall, %s of beer.\n",bnum(b)+bstr(b),bnum(b)+bstr(b));
  if(b){
    Message("Take one down and pass it around, %s of beer on the wall.\n\n",bnum(b-1)+bstr(b-1));
  }else{
    Message("Go to the store and buy some more, 99 bottles of beer on the wall.\n");
  }
  return b-1;
}

static bstr(b){
  auto thestr;
  thestr="bottles";
  if(b == 1){
    thestr = substr(thestr,0,strlen(thestr)-1);
  }
  return thestr;
}

static bnum(b){
  auto thenum;
  if(b == 0){
    thenum = "no more ";
  }else{
    thenum = form("%d ",b);
  }
  return thenum;  
}

Download Source | Write Comment

Alternative Versions

Comments

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: