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 Micro Focus COBOL for .net

(COBOL for the .net platform by Micro Foc)

Date:09/03/09
Author:Alex Turner
URL:http://nerds-central.blogspot.com
Comments:0
Info:http://www.microfocus.com
Score: (2.89 in 9 votes)
      $set sourceformat(free)
 01 bottles         pic 99.
 01 bottles-1       pic 9.
 01 bottle-word     string.
 01 count-word      string.

 perform  varying bottles from 99 by -1 until count-word equals "No"
    evaluate bottles
        when 0
            move "No"      to count-word
            move "bottles" to bottle-word
        when 1
            move bottles   to bottles-1
            move bottles-1 to count-word   
            move "bottle"  to bottle-word
        when 2 thru 9
            move bottles   to bottles-1
            move bottles-1 to count-word   
            move "bottles" to bottle-word
        when 10 thru 99
            move bottles   to count-word
            move "bottles" to bottle-word
    end-evaluate
    
    if bottles not equals 99 then
        display "Take one down and pass it around, " count-word::"ToLower"() 
                " more " bottle-word " of beer on the wall."
    end-if
                
    display count-word " " bottle-word 
        " of beer on the wall, " count-word::"ToLower"() 
        " " bottle-word " of beer."
        
 end-perform
 display "Go to the store and buy some more, 99 bottles of beer on the wall."
 goback.

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: