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 CSC4

Date:11/28/05
Author:Christian Klauser
URL:http://klauser.ttcaarberg.ch
Comments:0
Info:http://sourceforge.net/projects/csc4
Score: (2.32 in 19 votes)
#Some meta information
meta Name: "99BottlesOfBeer"
meta Description: "Sample code in CSC4. Generates the lyrics to the Song \"99 Bottles of Beer\""
meta Author: "Christian Klauser"
meta Web: "http://klauser.ttcaarberg.ch"

#The entry point of the application
procedure main(){
	#Declaration of some local variables
	var n = 99
	var str
	var form
	
	#main loop
	while(n >= 0){
		#get the correct form of the noun beer
		form = bottle(n)
		echo(form & " of beer on the wall, " & form & " of beer.")
		n-=1
		if(n > 0){
			echo("Take one down and pass it around, " & bottle(n) & " of beer on the wall")
		}else{
			echo(" Go to the store and buy some more, 99 bottles of beer on the wall.")
		}
	}
}

procedure bottle(count:int32):string{
	if(count <= 0){
		return = "no more bottle"
	}elseif(count == 1){
		return = "one bottle"
	}else{
		return = count & " bottles"
	}
}

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: