51 lines
1.6 KiB
COBOL
51 lines
1.6 KiB
COBOL
IDENTIFICATION DIVISION.
|
|
PROGRAM-ID. carmag0.
|
|
AUTHOR. OD.
|
|
*----------------------------------------------------------------*
|
|
* PROGRAMME *
|
|
* CREATION TABLEAU IMPAIR *
|
|
*----------------------------------------------------------------*
|
|
|
|
ENVIRONMENT DIVISION.
|
|
|
|
DATA DIVISION.
|
|
WORKING-STORAGE SECTION.
|
|
*--------------------------*
|
|
* DEFINITION DES VARIABLES *
|
|
*--------------------------*
|
|
* Nombre entrée
|
|
77 NBR-DPRT PICTURE 99 VALUE ZERO.
|
|
* Tableau du carré magique
|
|
01 TABLE-CARMAG.
|
|
* - Numé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é magique terminé.".
|
|
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Ães (" CRSR-LGN ", " CRSR-CLN ") : "
|
|
CNTN(CRSR-LGN, CRSR-CLN).
|