Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87 identification division. program-id. mat. environment division. input-output section. file-control. select f1 assign to "c:\matrice1.txt". select f2 assign to "c:\matrice2.txt". data division. file section. fd f1 label record standard data record enreg1. 01 enreg1 pic 9(5). fd f2 label record standard data record enreg2. 01 enreg2 pic 9(5). working-storage section. 77 nbl pic 9(5). 77 nbc pic 9(5). 77 i pic 9(2). 77 j pic 9(2). 77 nbrel pic 9(5). 77 n pic 9(2). 77 fdf pic 9 value 0. 77 var pic 9(5). procedure division. open output f1. display "saisir le nbr de lignes". accept nbl. display "saisir le nbr de colonnes". accept nbc. move 1 to i. move 1 to j. compute nbrel = nbl * nbc. move 1 to n. perform saisie until n > nbrel. close f1. move 1 to i. move 0 to j. move 1 to var. move 0 to n open output f2. perform trait until var > cl. close f2. open input f2. display "la transposeé est:". read f2 at end move 1 to fdf. perform affich until fdf = 1. close f2. stop run. saisie. display "donner l'‚lement:",i,j. accept enreg1. if (j < nbc) then add 1 to j else move 1 to j add 1 to i add 1 to n write enreg1 end-if. trait. move 0 to fdf. open input f1. read f1 at end move 1 to fdf. perform trans until fdf = 1. close f1. trans. if (j < nbc) then add 1 to j else move 1 to j. add 1 to i. if (j = var) then move enreg1 to enreg2. write enreg2. add 1 to n. read f1 at end move 1 to fdf. affich. display " la transpos‚ d'une matrice est:". accept enreg2. read f2 at end move 1 to fdf.
Partager