identificationdivision. program-id. sort-array. * aus Wirth, systematisches Programmieren p. 84 author. "JD". date-written. 11.9.2005. date-compiled. datadivision. working-storagesection.
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). linkagesection.
77 x pic 9(4)V9(4) occurs n. proceduredivisionusing x. * sort array x performvarying h from 1 by 1 until h >=n - 1 move h to j performvarying k from h+1 by 1 until k>=n if x(k) > x(j) thenmove 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.12 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.