Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Delphi/Elbe 1.0/Sources/   (Columbo Version 0.7©)  Datei vom 29.7.2010 mit Größe 11 kB image not shown  

SSL stack.cob   Sprache: Cobol

 

       identification division.
       program-id. stack.
      * Autor JD
      * Dies ist ein Stack-Beispiel
      * analog Uni-Bremen, J. Quante
      * das 1. pop() ist undefiniert
       author. "JD".
       date-written. 27.12.2006.
       date-compiled.
       data division.
       working-storage section.
         78 n         value 100.
         77 stack     pic 9(8) occurs n.
         77 stp       pic 9(8).
         77 item      pic 9(8).
       procedure division.
         display "start"
         perform newstack
         perform with test after
         until item=0
      *   some code
           perform pop
           display "Top of Stack is" item
         end-perform.
         display "done".
         stop run.
        newstack.
          move -1 to stp
        push.
          add 1 to stp
          if stp>n then display "Stacküberlauf" stop run end-if
          move item to stack(stp)
        pop.
          if stp<0 then display "Stackunterlauf" stop run end-if
          move stack(stp) to item
        tops.
          if stp<0 then move 0 to item
          else move stack(stp) to item
        end-program stack.

Messung
CHZG
9010010096

¤ Dauer der Verarbeitung: 0.5 Sekunden  (vorverarbeitet am  2026-11-25) ¤

*Bot Zugriff