products/sources/formale sprachen/Isabelle/Tools/jEdit/dist/jEdit/icons image not shown  

Quellcode-Bibliothek

© Kompilation durch diese Firma

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

Datei:   Sprache: Unknown

       identification division.
       program-id. succ.
      * aus Herold/Lutz/Wohlrab
      * Grundlagen der Informatik
      * p. 629
       author. JD.
       date-written. 3.11.2008.
       date-compiled.
       data division.
       linkage section.
       77 x pic 9(8).
       77 r pic 9(8).
       procedure division using x  returning r.
          add 1 to x giving r.
        end-program succ.

       identification division.
       program-id. pred.
       data division.
       linkage section.
       77 x pic 9(8).
       77 r pic 9(8).
       procedure division using x  returning r.
          if x=0 move 0 to r else subtract 1 from x giving r.
        end-program pred.

       identification division.
       program-id. adder.
      * dito
       data division.
       linkage section.
       77 x pic 9(8).
       77 y pic 9(8).
       77 i pic 9(8).
       77 wert pic 9(8).
       procedure division using x y returning wert.
          move 0 to wert
          perform varying i from 1 until i>y
            move function succ(wert) to wert
          end-perform
        end-program adder.

       identification division.
       program-id. mult.
      * dito
       data division.
       linkage section.
       77 x pic 9(8).
       77 y pic 9(8).
       77 i pic 9(8).
       77 wert pic 9(8).
       procedure division using x y returning wert.
          move 0 to wert
          perform varying i from 1 until i>y
            move function succ(wert) to wert
          end-perform
        end-program mult.

       identification division.
       program-id. main.
      * dito
       data division.
       working-storage section.
       77 x pic 9(8).
       77 y pic 9(8).
       77 r pic 9(8).
       procedure division using x y returning r.
          display "Gib zwei zahlen durch Komma getrennt ein:"
          accept x
          accept y
          move function adder(x,y) to r
          display "Add("x","y"="r
          move function mult(x,y) to r
          display "mult("x","y"="r
        end-program main.

[ Dauer der Verarbeitung: 0.1 Sekunden  (vorverarbeitet)  ]