identification division.
program-id. maxmin.
author. " Gannod/Cheng - Strongest Postcondition".
date-written. 2.1.2006.
data division.
working-storage section.
77 a pic 9(4)V99.
77 b pic 9(4)V99.
77 c pic 9(4)V99.
77 Largest pic 9(4)V99.
77 Smallest pic 9(4)V99.
procedure division.
move 5 to a
move 10 to b
call swapa using a, b
call swapb using a, b
call funnyswap using a, b
call FindMaxMin using a, b, Largest, Smallest
move Largest to c
end-program maxmin.
identification division.
program-id. FindMaxMin.
author. " Gannod/Cheng - Strongest Postcondition".
date-written. 2.1.2006.
data division.
linkage section.
77 NumOne pic 9(4)V99.
77 NumTwo pic 9(4)V99.
77 Maxx pic 9(4)V99.
77 Minn pic 9(4)V99.
procedure division using NumOne, NumTwo, Maxx, Minn.
if NumOne > NumTwo then
move NumOne to Maxx
move NumTwo to Minn
else
move NumTwo to Maxx
move NumOne to Minn
end-if
end-program FindMaxMin.
identification division.
program-id. swapa.
author. " Gannod/Cheng - Strongest Postcondition".
date-written. 2.1.2006.
data division.
linkage section.
77 X pic 9(4)V99.
77 Y pic 9(4)V99.
procedure division using X, Y.
add X to Y
subtract X from Y giving X
subtract X from Y
end-program swapa.
identification division.
program-id. swapb.
author. " Gannod/Cheng - Strongest Postcondition".
date-written. 2.1.2006.
data division.
working-storage section.
77 temp pic 9(4)V99.
linkage section.
77 X pic 9(4)V99.
77 Y pic 9(4)V99.
procedure division using X, Y.
move X to temp
move Y to X
move temp to Y
end-program swapb.
identification division.
program-id. funnyswap.
author. " Gannod/Cheng - Strongest Postcondition".
date-written. 2.1.2006.
data division.
working-storage section.
77 temp pic 9(4)V99.
linkage section.
77 X pic 9(4)V99.
77 Y pic 9(4)V99.
procedure division using X, Y.
move temp to X
move Y to X
move temp to Y
end-program funnyswap.
¤ Dauer der Verarbeitung: 0.14 Sekunden
(vorverarbeitet)
¤
|
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.
|