Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
26
Task/Reverse-a-string/Simula/reverse-a-string.simula
Normal file
26
Task/Reverse-a-string/Simula/reverse-a-string.simula
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
BEGIN
|
||||
TEXT PROCEDURE REV(S); TEXT S;
|
||||
BEGIN
|
||||
TEXT T;
|
||||
INTEGER L,R;
|
||||
T :- COPY(S);
|
||||
L := 1; R := T.LENGTH;
|
||||
WHILE L < R DO
|
||||
BEGIN
|
||||
CHARACTER CL,CR;
|
||||
T.SETPOS(L); CL := T.GETCHAR;
|
||||
T.SETPOS(R); CR := T.GETCHAR;
|
||||
T.SETPOS(L); T.PUTCHAR(CR);
|
||||
T.SETPOS(R); T.PUTCHAR(CL);
|
||||
L := L+1;
|
||||
R := R-1;
|
||||
END;
|
||||
REV :- T;
|
||||
END REV;
|
||||
|
||||
TEXT INP;
|
||||
INP :- "asdf";
|
||||
|
||||
OUTTEXT(INP); OUTIMAGE;
|
||||
OUTTEXT(REV(INP)); OUTIMAGE;
|
||||
END
|
||||
Loading…
Add table
Add a link
Reference in a new issue