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 PocketC

Date:04/20/05
Author:John Eriksson
URL:n/a
Comments:0
Info:http://www.orbworks.com
Score: (3.02 in 110 votes)
//99-Bottles-of-beer
//Made by John Eriksson 2003
//Compile with PocketC for PalmOS
//http://www.orbworks.com

#define memo "99-Bottles-of-beer"

char n='n';

getnbr(int i){
string s;
switch(i){
   case 0:
      s=n+"o more bottles";
      if(n=='n') n='N';
      else n='n';
   break;
   case 1:
      s="1 bottle";
   break;
   default:
      s=i+" bottles";
   break;
}
return(s);
}

 

main(){
int b=99,m,x=1;

if((m=mmfind(memo))>0)
   mmdelete();
m=mmnew();
mmputs(memo+"\n\n");
clear();
puts("Please wait...\n");
while(x){
   mmputs(getnbr(b)+" of beer on the wall, "+getnbr(b)+" of beer.\n");
   b--;
   if(b<0){
      b=99;
      x=0;
      mmputs("Go to the store, buy some more, ");
   }
   else 
      mmputs("Take one down, pass it around, ");
   mmputs(getnbr(b)+" of beer on the wall.\n");
}
puts("Done!\n");
mmclose();
alert("Song is stored in the memo named '"+memo+"'");
}

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: