Récupération des fichiers de l'IUT sur sterne.u-strasbg.fr
This commit is contained in:
parent
d135138eed
commit
53195fdfcd
BIN
P5B1/carmag
BIN
P5B1/carmag
Binary file not shown.
163
P5B1/carmag.cbl
163
P5B1/carmag.cbl
@ -1,163 +0,0 @@
|
||||
IDENTIFICATION DIVISION.
|
||||
PROGRAM-ID. carmag0.
|
||||
|
||||
AUTHOR. OD.
|
||||
***---------------------------------------------------------------
|
||||
|
||||
*----------------------------------------------------------------*
|
||||
* PROGRAMME *
|
||||
* CREATION TABLEAU IMPAIR *
|
||||
*----------------------------------------------------------------*
|
||||
|
||||
ENVIRONMENT DIVISION.
|
||||
***---------------------------------------------------------------
|
||||
|
||||
DATA DIVISION.
|
||||
WORKING-STORAGE SECTION.
|
||||
*--------------------------*
|
||||
* DEFINITION DES VARIABLES *
|
||||
*--------------------------*
|
||||
* Nombre entre au clavier
|
||||
77 NBR-DPRT PICTURE 999 VALUE ZERO.
|
||||
* Tableau du carre magique
|
||||
01 TABLE-CARMAG.
|
||||
* - Numero de ligne
|
||||
05 LGN OCCURS 25.
|
||||
* - Colonnes de la ligne
|
||||
10 CLN OCCURS 25.
|
||||
* - - Contenu de chaque colonne : chiffre
|
||||
15 CNTN PICTURE 999.
|
||||
* Nombre pour verifier le nombre saisie
|
||||
77 NBR PICTURE 999 VALUE ZERO.
|
||||
88 IMPAIR VALUE 1.
|
||||
* Valeur a inserer dans le tableau final
|
||||
77 VALEUR PICTURE 999 VALUE 1.
|
||||
* Curseur ligne
|
||||
77 CRSR-LGN PICTURE 999 VALUE 1.
|
||||
* Curseur colonne
|
||||
77 CRSR-CLN PICTURE 999 VALUE 1.
|
||||
* Total d'un calcul puis reutilisation pour diverses taches
|
||||
77 TOTAL PICTURE 999 VALUE ZERO.
|
||||
* Nombre de cases dans le tableau a afficher
|
||||
77 NBR-CRR PICTURE 999 VALUE ZERO.
|
||||
* Reste dans la division euclidienne
|
||||
77 RST PICTURE 999 VALUE ZERO.
|
||||
***---------------------------------------------------------------
|
||||
|
||||
PROCEDURE DIVISION.
|
||||
*
|
||||
* Nom du programme
|
||||
*
|
||||
PROGRAMME SECTION.
|
||||
* Debut du programme (initialisation)
|
||||
DEBUT.
|
||||
DISPLAY "Debut de la saisie...".
|
||||
PERFORM SAISIE UNTIL IMPAIR.
|
||||
DISPLAY "Saisie terminee !".
|
||||
* Corps du programme (contenu)
|
||||
CORPS.
|
||||
DISPLAY "Taille du tableau : " NBR-DPRT.
|
||||
PERFORM REMPLISSAGE.
|
||||
* Fin du programme
|
||||
FIN.
|
||||
DISPLAY "Carre magique fini !!!".
|
||||
STOP RUN.
|
||||
|
||||
*
|
||||
* Arborescence de niveau 2 : Saisie de l'utilisateur
|
||||
*
|
||||
SAISIR SECTION.
|
||||
SAISIE.
|
||||
DISPLAY "Saisissez un chiffre impair inferieur a 26 : "
|
||||
WITH NO ADVANCING.
|
||||
ACCEPT NBR-DPRT.
|
||||
PERFORM VERIF.
|
||||
VERIF.
|
||||
DIVIDE NBR-DPRT BY 2 GIVING TOTAL REMAINDER RST.
|
||||
IF (RST NOT EQUAL TO ZERO AND NBR-DPRT LESS THAN 26) THEN
|
||||
MOVE 1 TO NBR.
|
||||
|
||||
*
|
||||
* Arborescence niveau 2 : REMPLISSAGE PUIS AFFICHAGE
|
||||
*
|
||||
REMPLISSAGE SECTION.
|
||||
* Affectation de la premiere valeur, ligne une, colonne du milieu
|
||||
VAL-UNE.
|
||||
DISPLAY "Affectation valeur une...".
|
||||
* COMPUTE TOTAL ROUNDED = NBR-DPRT / 2.
|
||||
DIVIDE 2 INTO NBR-DPRT GIVING TOTAL ROUNDED.
|
||||
* Affectation de la premiere valeur a la colonne trouvee
|
||||
MOVE 1 TO CNTN(1,TOTAL).
|
||||
* Affectation du numero de colonne vers le curseur des colonnes
|
||||
MOVE TOTAL TO CRSR-CLN.
|
||||
DISPLAY "Affectation terminee ! Colonne actuelle : " TOTAL.
|
||||
VAL-SUIV.
|
||||
DISPLAY "Affectation des valeurs suivantes...".
|
||||
MULTIPLY NBR-DPRT BY NBR-DPRT GIVING TOTAL.
|
||||
MOVE TOTAL TO NBR-CRR.
|
||||
PERFORM TRAITEMENT UNTIL VALEUR EQUAL TO NBR-CRR.
|
||||
DISPLAY "Affectations terminees ! Total : " VALEUR.
|
||||
AFFICHAGE.
|
||||
DISPLAY "AFFICHAGE DU TABLEAU".
|
||||
MOVE 1 TO CRSR-LGN.
|
||||
MOVE 1 TO CRSR-CLN.
|
||||
PERFORM PARCOURS VARYING CRSR-LGN FROM 1 BY 1 UNTIL CRSR-LGN
|
||||
> NBR-DPRT.
|
||||
* AFTER CRSR-CLN FROM 1 BY 1 UNTIL CRSR-CLN
|
||||
* > NBR-DPRT.
|
||||
DISPLAY "AFFICHAGE TERMINE".
|
||||
|
||||
*
|
||||
* Arborescence niveau 3 : TRAITEMENT PLACEMENT
|
||||
*
|
||||
TRAITEMENT SECTION.
|
||||
INCREMENTE.
|
||||
ADD 1 TO VALEUR.
|
||||
MLTPL.
|
||||
DIVIDE VALEUR BY NBR-DPRT GIVING TOTAL REMAINDER RST.
|
||||
IF (RST EQUAL TO 1) THEN
|
||||
PERFORM SS-PLCMT
|
||||
ELSE PERFORM SR-PLCMT.
|
||||
VERIFICATION.
|
||||
PERFORM VERIFIER.
|
||||
PLACEMENT.
|
||||
DISPLAY "|_Affectation de : " VALEUR.
|
||||
MOVE VALEUR TO CNTN(CRSR-LGN,CRSR-CLN).
|
||||
DISPLAY "| Affectee a : " CRSR-LGN ", "CRSR-CLN.
|
||||
|
||||
*
|
||||
* Arborescence niveau 3 : Affichage du tableau
|
||||
*
|
||||
AFFICHER SECTION.
|
||||
PARCOURS.
|
||||
PERFORM AFFICHE VARYING CRSR-CLN FROM 1 BY 1
|
||||
UNTIL CRSR-CLN >= NBR-DPRT.
|
||||
DISPLAY "|" CNTN(CRSR-LGN,CRSR-CLN) "|".
|
||||
AFFICHE.
|
||||
DISPLAY "|" CNTN(CRSR-LGN,CRSR-CLN) "|"
|
||||
WITH NO ADVANCING.
|
||||
|
||||
*
|
||||
* Arborescence niveau 4 : MULIPLE + 1
|
||||
*
|
||||
MULTPL SECTION.
|
||||
SS-PLCMT.
|
||||
ADD 1 TO CRSR-LGN.
|
||||
SR-PLCMT.
|
||||
SUBTRACT 1 FROM CRSR-LGN.
|
||||
SUBTRACT 1 FROM CRSR-CLN.
|
||||
|
||||
*
|
||||
* Arborescence niveau 4 : VERIFICATION LIGNE / COLONNE
|
||||
*
|
||||
VERIFIER SECTION.
|
||||
LIGNE.
|
||||
IF (CRSR-LGN < 1) THEN
|
||||
MOVE NBR-DPRT TO CRSR-LGN.
|
||||
IF (CRSR-LGN > NBR-DPRT) THEN
|
||||
MOVE 1 TO CRSR-LGN.
|
||||
COLONNE.
|
||||
IF (CRSR-CLN < 1) THEN
|
||||
MOVE NBR-DPRT TO CRSR-CLN.
|
||||
IF (CRSR-CLN > NBR-DPRT) THEN
|
||||
MOVE 1 TO CRSR-CLN.
|
BIN
P5B1/carmag0
BIN
P5B1/carmag0
Binary file not shown.
@ -1,50 +0,0 @@
|
||||
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).
|
@ -1,57 +0,0 @@
|
||||
IDENTIFICATION DIVISION.
|
||||
PROGRAM-ID. multpl.
|
||||
AUTHOR. OD.
|
||||
*----------------------------------------------------------------*
|
||||
* PROGRAMME *
|
||||
* VERIFICATION NOMBRE MULTIPLE D'UN AUTRE (IMPAIR) *
|
||||
*----------------------------------------------------------------*
|
||||
|
||||
ENVIRONMENT DIVISION.
|
||||
|
||||
DATA DIVISION.
|
||||
WORKING-STORAGE SECTION.
|
||||
*--------------------------*
|
||||
* DEFINITION DES VARIABLES *
|
||||
*--------------------------*
|
||||
* Nombre de départ
|
||||
77 NBR-DPRT PICTURE 99 VALUE ZERO.
|
||||
* Resultat dans la division euclidienne
|
||||
77 DV-ECLDN PICTURE 99 VALUE ZERO.
|
||||
* Reste dans la division euclidienne par 2
|
||||
77 RST PICTURE 9 VALUE ZERO.
|
||||
* Nombre impair ou pas ? (simulation d'un booléen)
|
||||
77 NBR PICTURE 99 VALUE ZERO.
|
||||
88 IMPAIR VALUE 1.
|
||||
* Résultat
|
||||
77 RSLTT PICTURE X(30).
|
||||
|
||||
PROCEDURE DIVISION.
|
||||
*--------------------*
|
||||
* DEBUT DU PROGRAMME *
|
||||
*--------------------*
|
||||
|
||||
PROGRAMME SECTION.
|
||||
|
||||
DEBUT.
|
||||
PERFORM SAISIE UNTIL IMPAIR.
|
||||
CORPS.
|
||||
PERFORM PARITE.
|
||||
FIN.
|
||||
DISPLAY RSLTT.
|
||||
STOP RUN.
|
||||
|
||||
SAISIR SECTION.
|
||||
SAISIE.
|
||||
DISPLAY "Saisissez un chiffre impair : "
|
||||
WITH NO ADVANCING.
|
||||
ACCEPT NBR-DPRT.
|
||||
PERFORM VERIF.
|
||||
VERIF.
|
||||
DIVIDE NBR-DPRT BY 2 GIVING DV-ECLDN REMAINDER RST.
|
||||
DISPLAY RST.
|
||||
IF (RST NOT EQUAL TO ZERO) THEN
|
||||
MOVE 1 TO NBR.
|
||||
PARITE.
|
||||
IF (IMPAIR) THEN
|
||||
MOVE "Le nombre est impair." TO RSLTT
|
||||
ELSE MOVE "Le nombre n'est pas impair." TO RSLTT.
|
@ -1,64 +0,0 @@
|
||||
IDENTIFICATION DIVISION.
|
||||
PROGRAM-ID. multpl.
|
||||
AUTHOR. OD.
|
||||
*----------------------------------------------------------------*
|
||||
* PROGRAMME *
|
||||
* VERIFICATION NOMBRE MULTIPLE D'UN AUTRE +1 *
|
||||
*----------------------------------------------------------------*
|
||||
|
||||
ENVIRONMENT DIVISION.
|
||||
|
||||
DATA DIVISION.
|
||||
WORKING-STORAGE SECTION.
|
||||
*--------------------------*
|
||||
* DEFINITION DES VARIABLES *
|
||||
*--------------------------*
|
||||
* Nombre de départ
|
||||
77 NBR-DPRT PICTURE 99 VALUE ZERO.
|
||||
* Nombre à tester
|
||||
77 NBR-TEST PICTURE 99 VALUE ZERO.
|
||||
* Resultat dans la division euclidienne
|
||||
77 DV-ECLDN PICTURE 99 VALUE ZERO.
|
||||
* Reste dans la division euclidienne par 2
|
||||
77 RST PICTURE 9 VALUE ZERO.
|
||||
* Nombre impair ou pas ? (simulation d'un booléen)
|
||||
77 NBR PICTURE 99 VALUE ZERO.
|
||||
88 MLTPL VALUE 1.
|
||||
* Résultat
|
||||
77 RSLTT PICTURE X(30).
|
||||
|
||||
PROCEDURE DIVISION.
|
||||
*--------------------*
|
||||
* DEBUT DU PROGRAMME *
|
||||
*--------------------*
|
||||
|
||||
PROGRAMME SECTION.
|
||||
|
||||
DEBUT.
|
||||
PERFORM SAISIE.
|
||||
CORPS.
|
||||
PERFORM PARITE.
|
||||
FIN.
|
||||
DISPLAY RSLTT.
|
||||
STOP RUN.
|
||||
|
||||
SAISIR SECTION.
|
||||
SAISIE.
|
||||
DISPLAY "Saisissez un chiffre de base : "
|
||||
WITH NO ADVANCING.
|
||||
ACCEPT NBR-DPRT.
|
||||
DISPLAY "Saisissez le chiffre suivant : "
|
||||
WITH NO ADVANCING.
|
||||
ACCEPT NBR-TEST.
|
||||
PERFORM VERIF.
|
||||
VERIF.
|
||||
DIVIDE NBR-TEST BY NBR-DPRT GIVING DV-ECLDN REMAINDER RST.
|
||||
DISPLAY "RESTE : " RST.
|
||||
IF (RST EQUAL TO 1) THEN
|
||||
MOVE 1 TO NBR.
|
||||
PARITE.
|
||||
IF (MLTPL) THEN
|
||||
MOVE "Le nombre est un multiple incrémentÃde un"
|
||||
TO RSLTT
|
||||
ELSE MOVE "Le nombre n'est pas un multiple incrÃment
|
||||
- "Ã de un." TO RSLTT.
|
BIN
P5B1/palind
BIN
P5B1/palind
Binary file not shown.
@ -1,91 +0,0 @@
|
||||
IDENTIFICATION DIVISION.
|
||||
PROGRAM-ID. palind.
|
||||
AUTHOR. OD.
|
||||
*-------------------------------------------*
|
||||
* PROGRAMME DE VERIFICATION D'UN PALINDROME *
|
||||
*-------------------------------------------*
|
||||
|
||||
ENVIRONMENT DIVISION.
|
||||
DATA DIVISION.
|
||||
|
||||
WORKING-STORAGE SECTION.
|
||||
*--------------------------*
|
||||
* DEFINITION DES VARIABLES *
|
||||
*--------------------------*
|
||||
* LE MOT DONNE PAR L'UTILISATEUR
|
||||
77 MOT PICTURE X(255) VALUE SPACE.
|
||||
* RESULTAT DU PROGRAMME (ICI ON DIRA "CECI EST UN PALINDROME")
|
||||
* OU PAS)
|
||||
77 RESULTAT PICTURE X(30) VALUE SPACE.
|
||||
* DEBUT-MOT ET DBUT-FIN SUBISSENT UNE INCREMENTATION
|
||||
* CE SONT LES CURSEURS
|
||||
77 DEBUT-MOT PICTURE 99 VALUE 1.
|
||||
77 FIN-MOT PICTURE 99 VALUE 30.
|
||||
* LETTREG CONTIENDRA UNE LETTRE DU MOT, CELLE COTE GAUCHE
|
||||
* LETTRED, CELLE COTE DROITE
|
||||
77 LETTREG PICTURE X VALUE SPACE.
|
||||
77 LETTRED PICTURE X VALUE SPACE.
|
||||
* DEFINITION DE QUELQUES VALEUR NUMERIQUES
|
||||
* POUR LES CONTROLES
|
||||
01 ETUDE-ENONCE.
|
||||
05 COMP-VALID PICTURE 9 VALUE 1.
|
||||
88 COMP-CORRECT VALUE 1.
|
||||
05 CARAC-DEB PICTURE 9 VALUE 1.
|
||||
88 CARACD-CORRECT VALUE 1.
|
||||
05 CARAC-FIN PICTURE 9 VALUE 1.
|
||||
88 CARACF-CORRECT VALUE 1.
|
||||
|
||||
PROCEDURE DIVISION.
|
||||
*NOM DU PROGRAMME
|
||||
PRINCIPAL SECTION.
|
||||
|
||||
DEBUT.
|
||||
PERFORM SAISIE.
|
||||
CORPS.
|
||||
PERFORM TRAITER.
|
||||
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 COMPARER UNTIL NOT COMP-CORRECT.
|
||||
*VALIDE IS NOT EQUAL TO 1.
|
||||
|
||||
*COMPARAISON DE LA CHAINE DE CARACTÈRE
|
||||
COMPARER.
|
||||
DISPLAY DEBUT-MOT.
|
||||
DISPLAY FIN-MOT.
|
||||
* PERFORM PARCOURS-FIN UNTIL NOT CARACF-CORRECT.
|
||||
MOVE ZERO TO COMP-VALID.
|
||||
|
||||
*PARCOURS DE LA CHAINE DE FIN
|
||||
PARCOURS-FIN.
|
||||
DISPLAY "DERNIERE LETTRE DU MOT : " MOT(FIN-MOT:1).
|
||||
IF (MOT(FIN-MOT:1) EQUAL TO SPACE) THEN
|
||||
SUBTRACT 1 FROM FIN-MOT
|
||||
ELSE MOVE 1 TO CARAC-FIN
|
||||
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 À COMPARER
|
||||
CAL-CHFFRE.
|
||||
IF (MOT(FIN-MOT:1) EQUAL TO SPACE) THEN
|
||||
SUBTRACT 1 FROM FIN-MOT
|
||||
END-IF.
|
Loading…
Reference in New Issue
Block a user