Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Cobol/verschiedene-Autoren/Herold Lurz Wohlrab/   (Columbo Version 0.7©)  Datei vom 13.3.2015 mit Größe 1 kB image not shown  

Quelle  primitive-p629.cob   Sprache: Cobol

 
       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 r pic 9(8).
       procedure division using x y returning r.
          if x=0 move y to r
          else
           compute r=function succ (function adder(function pred(x),y)).
        end-program adder.

       identification division.
       program-id. mult.
      * dito
       data division.
       linkage section.
       77 x pic 9(8).
       77 y pic 9(8).
       77 r pic 9(8).
       procedure division using x y returning r.
          if x=0 move 0 to r
          else
            compute r=function adder(function mult(function pred(x),y))
        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 Kommata 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.

Messung V0.5
C=85 H=100 G=92

¤ Dauer der Verarbeitung: 0.11 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

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 und die Messung sind noch experimentell.