Input/Output for lines of text: Difference between revisions

Content added Content deleted
(Added solution for Action!)
Line 41: Line 41:
V line = input()
V line = input()
do_stuff(line)</lang>
do_stuff(line)</lang>

=={{header|Action!}}==
The user must type in the monitor the following command after compilation and before running the program!<pre>SET EndProg=*</pre>
{{libheader|Action! Tool Kit}}
<lang Action!>CARD EndProg ;required for ALLOCATE.ACT

INCLUDE "D2:ALLOCATE.ACT" ;from the Action! Tool Kit. You must type 'SET EndProg=*' from the monitor after compiling, but before running this program!

PROC Main()
DEFINE PTR="CARD"
BYTE i,nLines
PTR ARRAY lines(256)
CHAR ARRAY line(256),p

AllocInit(0)
Put(125) PutE()

nLines=InputB()
IF nLines=0 THEN RETURN FI

FOR i=0 TO nLines-1
DO
InputS(line)
p=Alloc(line(0)+1)
MoveBlock(p,line,line(0)+1)
lines(i)=p
OD

PutE()
FOR i=0 TO nLines-1
DO
p=lines(i)
PrintE(p)
OD

FOR i=0 TO nLines-1
DO
p=lines(i)
Free(p,p(0)+1)
lines(i)=0
OD
nLines=0
RETURN</lang>
{{out}}
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Input_Output_for_lines_of_text.png Screenshot from Atari 8-bit computer]
<pre>
3
hello
hello world
Pack my Box with 5 dozen liquor jugs

hello
hello world
Pack my Box with 5 dozen liquor jugs
</pre>


=={{header|Ada}}==
=={{header|Ada}}==