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

Quelle  loop-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 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.

94%


¤ Dauer der Verarbeitung: 0.13 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 ist noch experimentell.