cours0708/P5B1/carmag0.cbl

51 lines
1.6 KiB
Plaintext
Raw Normal View History

IDENTIFICATION DIVISION.
PROGRAM-ID. carmag0.
AUTHOR. OD.
*----------------------------------------------------------------*
* PROGRAMME *
* CREATION TABLEAU IMPAIR *
*----------------------------------------------------------------*
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
*--------------------------*
* DEFINITION DES VARIABLES *
*--------------------------*
* Nombre entr<74>e
77 NBR-DPRT PICTURE 99 VALUE ZERO.
* Tableau du carr<72> magique
01 TABLE-CARMAG.
* - Num<75>ro de ligne
05 NM-LGN OCCURS 31.
* - Colonnes de la ligne
10 CLN OCCURS 31.
* - - Contenu de chaque colonne : chiffre
15 CNTN PICTURE 99.
* Curseur ligne
77 CRSR-LGN PICTURE 99 VALUE 1.
77 CRSR-CLN PICTURE 99 VALUE 1.
PROCEDURE DIVISION.
PROGRAMME SECTION.
DEBUT.
MOVE 3 TO NBR-DPRT.
CORPS.
DISPLAY "Taille du tableau : " NBR-DPRT.
PERFORM PARCOURS.
FIN.
DISPLAY "Carr<72> magique termin<69>.".
STOP RUN.
TRAITEMENTS SECTION.
PARCOURS.
PERFORM REMP VARYING CRSR-LGN FROM 1 BY 1 UNTIL CRSR-LGN
> NBR-DPRT AFTER CRSR-CLN FROM 1 BY 1 UNTIL CRSR-CLN
> NBR-DPRT.
REMP.
MOVE 1 TO CNTN(CRSR-LGN, CRSR-CLN).
DISPLAY "Coordonn<6E>es (" CRSR-LGN ", " CRSR-CLN ") : "
CNTN(CRSR-LGN, CRSR-CLN).