Strana 4 z 4
ANSI '85
JDoodle - Online COBOL Compiler IDE ...
(Ctrl+C, open link in new panel, Ctrl+V, Submit)
identification division. program-id. TYPEWRITER. *> keyboard - memory - screen *> structured code with scope-delimiters *> *** execute in Interactive mode *** data division. working-storage section. 1 TW-MEMORY. 2 INP-LINE pic x(80) occurs 5. 77 I pic 9. 77 MEM pic 9. 88 MEM-BEG value 0. 88 MEM-END value 1. procedure division. initialize TW-MEMORY set MEM-BEG to true display "write text max 5 times, at end write e:" display " " perform varying I from 1 by 1 until I > 5 or MEM-END accept INP-LINE(I) if INP-LINE(I) = "e" set MEM-END to true end-if end-perform display " entry is complete" display " " perform varying I from 1 by 1 until INP-LINE(I) = "e" or I > 5 display I ". " INP-LINE(I) end-perform display " the work is finished ***" stop run.
I = keyboard, W = memory, O = screen:
write text max 5 times, at end write e: aaaaaaaa bbbbbbbb cccccccc e entry is complete 1. aaaaaaaa 2. bbbbbbbb 3. cccccccc
the work is finished
Čevela - 8.5.2020
- << Předchozí
- Další