How to resolve the algorithm The Twelve Days of Christmas step by step in the MAD programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm The Twelve Days of Christmas step by step in the MAD programming language

Table of Contents

Problem Statement

Write a program that outputs the lyrics of the Christmas carol The Twelve Days of Christmas. The lyrics can be found here.
(You must reproduce the words in the correct order, but case, format, and punctuation are left to your discretion.)

Let's start with the solution:

Step by Step solution about How to resolve the algorithm The Twelve Days of Christmas step by step in the MAD programming language

Source code in the mad programming language

            NORMAL MODE IS INTEGER
            
            THROUGH VERSE, FOR I=1, 1, I.G.12
            PRINT FORMAT XMS,ORD(I)
            PRINT FORMAT TLV
            TRANSFER TO GIFT(13-I)
GIFT(1)     PRINT FORMAT G12
GIFT(2)     PRINT FORMAT G11
GIFT(3)     PRINT FORMAT G10
GIFT(4)     PRINT FORMAT G9
GIFT(5)     PRINT FORMAT G8
GIFT(6)     PRINT FORMAT G7
GIFT(7)     PRINT FORMAT G6
GIFT(8)     PRINT FORMAT G5
GIFT(9)     PRINT FORMAT G4
GIFT(10)    PRINT FORMAT G3
GIFT(11)    PRINT FORMAT G2
GIFT(12)    PRINT FORMAT G1
VERSE       PRINT FORMAT MT
            
            VECTOR VALUES XMS = 
          0        $7HON THE ,C,S1,16HDAY OF CHRISTMAS*$
            VECTOR VALUES ORD = $*$, $FIRST$, $SECOND$, $THIRD$
          0 ,      $FOURTH$, $FIFTH$, $SIXTH$, $SEVENTH$, $EIGHTH$
          1 ,      $NINTH$, $TENTH$, $ELEVENTH$, $TWELFTH$
            VECTOR VALUES TLV = $23HMY TRUE LOVE GAVE TO ME*$
            VECTOR VALUES G12 = $24HTWELVE DRUMMERS DRUMMING*$
            VECTOR VALUES G11 = $20HELEVEN PIPERS PIPING*$
            VECTOR VALUES G10 = $19HTEN LORDS A-LEAPING*$
            VECTOR VALUES G9  = $19HNINE LADIES DANCING*$
            VECTOR VALUES G8  = $21HEIGHT MAIDS A-MILKING*$
            VECTOR VALUES G7  = $22HSEVEN SWANS A-SWIMMING*$
            VECTOR VALUES G6  = $18HSIX GEESE A-LAYING*$
            VECTOR VALUES G5  = $17HFIVE GOLDEN RINGS*$
            VECTOR VALUES G4  = $18HFOUR CALLING BIRDS*$
            VECTOR VALUES G3  = $17HTHREE FRENCH HENS*$
            VECTOR VALUES G2  = $20HTWO TURTLE DOVES AND*$
            VECTOR VALUES G1  = $26HA PARTRIDGE IN A PEAR TREE*$
            VECTOR VALUES MT  = $*$
            END OF PROGRAM

  

You may also check:How to resolve the algorithm N-queens problem step by step in the Perl programming language
You may also check:How to resolve the algorithm Bitmap/Write a PPM file step by step in the BBC BASIC programming language
You may also check:How to resolve the algorithm Arithmetic/Integer step by step in the Oforth programming language
You may also check:How to resolve the algorithm Hailstone sequence step by step in the VBScript programming language
You may also check:How to resolve the algorithm Wireworld step by step in the JavaScript programming language