products/Sources/formale Sprachen/COBOL/verschiedene-Autoren/Wirth image not shown  

Quellcode-Bibliothek

© Kompilation durch diese Firma

[Weder Korrektheit noch Funktionsfähigkeit der Software werden zugesichert.]

Datei: IBM1129.map   Sprache: Unknown

       identification division.
       program-id. sort-array.
      *  aus Wirth, systematisches Programmieren p. 84 
       author"JD".
       date-written. 11.9.2005.
       date-compiled.
       data division.
       working-storage section.
       78 n   pic 9(4) value 10.
       77 s   pic 9(4)V9(4).
       77 u   pic 9(4)V9(4).
       77 h   pic 9(4).
       77 j   pic 9(4).
       77 k   pic 9(4).
       linkage section.
       77 x   pic 9(4)V9(4) occurs n.
       procedure division using x.
      * sort array x
         perform varying h from 1 by 1 until h >=n - 1
           move h to j
           perform varying k from h+1 by 1 until k>=n
             if x(k) > x(j) then move k to j
           end-perform
           move x(h) to u
           move x(j) to x(h)
           move u to x(j)
         end-perform
         display "sorted"
      * now x is sorted
        end-program  sort-array.

[ Dauer der Verarbeitung: 0.18 Sekunden  (vorverarbeitet)  ]