Skip to content

Instantly share code, notes, and snippets.

@guaracy
Last active November 3, 2016 13:47
Show Gist options
  • Save guaracy/c4e240d68f4894d01c14 to your computer and use it in GitHub Desktop.
Save guaracy/c4e240d68f4894d01c14 to your computer and use it in GitHub Desktop.

Revisions

  1. guaracy revised this gist Feb 8, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 99bottles.cob
    Original file line number Diff line number Diff line change
    @@ -19,7 +19,7 @@
    end-if
    if bottles not equal max
    display "Take one down and pass it arround"
    display z9 bottles " " bottle-word " of beer on the wall."
    display bottles " " bottle-word " of beer on the wall."
    display " "
    end-if
    display bottles " " bottle-word " of beer on the wall"
  2. guaracy revised this gist Feb 6, 2016. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions 99bottles.cob
    Original file line number Diff line number Diff line change
    @@ -8,10 +8,10 @@
    77 max pic 9(02) value 99.
    77 bottle-word pic x(07).
    77 bottles pic 99.
    88 terminou value 0.
    88 too-drunk value 0.

    procedure division.
    perform varying bottles from max by -1 until terminou
    perform varying bottles from max by -1 until too-drunk
    if bottles = 1
    move "bottle" to bottle-word
    else
  3. guaracy created this gist Feb 6, 2016.
    33 changes: 33 additions & 0 deletions 99bottles.cob
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,33 @@
    identification division.
    program-id. 99-bottles.

    data division.

    working-storage section.

    77 max pic 9(02) value 99.
    77 bottle-word pic x(07).
    77 bottles pic 99.
    88 terminou value 0.

    procedure division.
    perform varying bottles from max by -1 until terminou
    if bottles = 1
    move "bottle" to bottle-word
    else
    move "bottles" to bottle-word
    end-if
    if bottles not equal max
    display "Take one down and pass it arround"
    display z9 bottles " " bottle-word " of beer on the wall."
    display " "
    end-if
    display bottles " " bottle-word " of beer on the wall"
    display bottles " " bottle-word " of beer"
    end-perform.
    display "Take one down and pass it arround"
    display "No more bottles of beer on the wall."
    display " "
    display "Go to the store and buy some more "
    display max " bottles of beer on the wall.".
    stop run.