71 lines
2.0 KiB
Plaintext
71 lines
2.0 KiB
Plaintext
|
IDENTIFICATION DIVISION.
|
|||
|
PROGRAM-ID. palind.
|
|||
|
AUTHOR. OD.
|
|||
|
*-------------------------------------------*
|
|||
|
* PROGRAMME DE VERIFICATION D'UN PALINDROME *
|
|||
|
*-------------------------------------------*
|
|||
|
|
|||
|
ENVIRONMENT DIVISION.
|
|||
|
DATA DIVISION.
|
|||
|
|
|||
|
WORKING-STORAGE SECTION.
|
|||
|
*--------------------------*
|
|||
|
* DEFINITION DES VARIABLES *
|
|||
|
*--------------------------*
|
|||
|
77 MOT PICTURE X(255) VALUE SPACE.
|
|||
|
77 RESULTAT PICTURE X(30) VALUE SPACE.
|
|||
|
77 DEBUT-MOT PICTURE 99 VALUE 1.
|
|||
|
77 FIN-MOT PICTURE 99 VALUE 29.
|
|||
|
77 LETTRE PICTURE X VALUE SPACE.
|
|||
|
77 VALIDE PICTURE 9 VALUE 1.
|
|||
|
88 CORRECT VALUE 1.
|
|||
|
|
|||
|
PROCEDURE DIVISION.
|
|||
|
*NOM DU PROGRAMME
|
|||
|
PRINCIPAL SECTION.
|
|||
|
|
|||
|
DEBUT.
|
|||
|
PERFORM SAISIE.
|
|||
|
CORPS.
|
|||
|
PERFORM TRAITEMENT.
|
|||
|
FIN.
|
|||
|
DISPLAY RESULTAT.
|
|||
|
DISPLAY "FIN DU TRAITEMENT".
|
|||
|
STOP RUN.
|
|||
|
|
|||
|
*SAISIE DU MOT
|
|||
|
SAISIR SECTION.
|
|||
|
SAISIE.
|
|||
|
DISPLAY "Saisissez une phrase : " WITH NO ADVANCING.
|
|||
|
ACCEPT MOT.
|
|||
|
*------*
|
|||
|
* TEST *
|
|||
|
*------*
|
|||
|
DISPLAY MOT.
|
|||
|
|
|||
|
*TRAITEMENT DE LA PHRASE
|
|||
|
TRAITEMENT SECTION.
|
|||
|
TRAITER.
|
|||
|
PERFORM PARCOURIR UNTIL VALIDE IS NOT EQUAL TO 1.
|
|||
|
|
|||
|
*PARCOURS DE LA CHAINE DE CARACT<43>RE, ET LONGUEUR DE CELLE CI
|
|||
|
PARCOURIR.
|
|||
|
MOVE ZERO TO VALIDE.
|
|||
|
DISPLAY DEBUT-MOT.
|
|||
|
DISPLAY FIN-MOT.
|
|||
|
MOVE 1 TO VALIDE.
|
|||
|
* IF (MOT(DEBUT-MOT:1) EQUAL TO SPACE) THEN
|
|||
|
* ADD 1 TO DEBUT-MOT
|
|||
|
* END-IF.
|
|||
|
* MOVE MOT(FIN-MOT:1) TO LETTRE.
|
|||
|
* PERFORM CAL-CHFFRE UNTIL LETTRE NOT EQUAL TO SPACE.
|
|||
|
* IF (MOT(DEBUT-MOT:1) EQUAL TO MOT(FIN-MOT:1))
|
|||
|
* MOVE 1 TO VALIDE
|
|||
|
* END-IF.
|
|||
|
|
|||
|
*CALCUL DU CHIFFRE DE LA LETTRE <20> COMPARER
|
|||
|
CAL-CHFFRE.
|
|||
|
IF (MOT(FIN-MOT:1) EQUAL TO SPACE) THEN
|
|||
|
SUBTRACT 1 FROM FIN-MOT
|
|||
|
END-IF.
|