How to resolve the algorithm Thue-Morse step by step in the COBOL programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Thue-Morse step by step in the COBOL programming language
Table of Contents
Problem Statement
Create a Thue-Morse sequence.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Thue-Morse step by step in the COBOL programming language
Source code in the cobol programming language
IDENTIFICATION DIVISION.
PROGRAM-ID. THUE-MORSE.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 STRINGS.
03 CURRENT-STATE PIC X(64).
03 TEMP PIC X(64).
PROCEDURE DIVISION.
BEGIN.
MOVE "0" TO CURRENT-STATE.
PERFORM THUE-MORSE-STEP 8 TIMES.
DISPLAY CURRENT-STATE.
STOP RUN.
THUE-MORSE-STEP.
MOVE CURRENT-STATE TO TEMP.
INSPECT TEMP REPLACING ALL '0' BY 'X'.
INSPECT TEMP REPLACING ALL '1' BY '0'.
INSPECT TEMP REPLACING ALL 'X' BY '1'.
STRING CURRENT-STATE DELIMITED BY SPACE,
TEMP DELIMITED BY SPACE
INTO CURRENT-STATE.
You may also check:How to resolve the algorithm Priority queue step by step in the D programming language
You may also check:How to resolve the algorithm Multisplit step by step in the zkl programming language
You may also check:How to resolve the algorithm Call a function step by step in the CoffeeScript programming language
You may also check:How to resolve the algorithm Two's complement step by step in the Craft Basic programming language
You may also check:How to resolve the algorithm Date format step by step in the Beads programming language