Terminal control/Cursor positioning: Difference between revisions
(→{{header|REXX}}: delerted previous entry, re-added language.) |
m (→{{header|REXX}}: the word "language" was missing from 1st sentence.) |
||
Line 39: | Line 39: | ||
=={{header|REXX}}== |
=={{header|REXX}}== |
||
The REXX doesn't have any cursor or screen management tools, but some REXX interpreters have added the functionality via different methods. |
The REXX language doesn't have any cursor or screen management tools, but some REXX interpreters have added the functionality via different methods. |
||
<br><br>Below is one example implented by PC/REXX: |
<br><br>Below is one example implented by PC/REXX: |
||
<lang rexx> |
<lang rexx> |
Revision as of 23:34, 19 December 2010
You are encouraged to solve this task according to the task description, using any language you may know.
Move the cursor to column 3, row 6 and display the word "Hello", so that the letter H is in column 3 on row 6.
BASIC
Locomotive Basic
<lang basic> 10 LOCATE 3,6
20 PRINT "Hello"</lang>
ZX Spectrum Basic
<lang basic> 10 REM The top left corner is at position 0,0
20 REM So we subtract one from the coordinates 30 PRINT AT 5,2 "Hello"</lang>
C
The C version of the minesweeper game uses curses. Minesweeper_game#C
Forth
<lang forth>2 5 at-xy ." Hello"</lang>
Logo
<lang logo>setcursor [2 5] type "Hello</lang> You can also draw positioned text on the turtle graphics window. <lang logo>setpos [20 50] setxy 20 30 ; alternate way to set position label "Hello</lang>
PicoLisp
<lang PicoLisp>(call 'tput "cup" 6 3) (prin "Hello")</lang>
PureBasic
<lang PureBasic>EnableGraphicalConsole(#True) ConsoleLocate(3,6) Print("Hello")</lang>
REXX
The REXX language doesn't have any cursor or screen management tools, but some REXX interpreters have added the functionality via different methods.
Below is one example implented by PC/REXX:
<lang rexx>
/*REXX program demonstrates cursor position and writing of text to same.*/
/*──────────────────────────────────────────────────────────────────────*/ /*─────────────────────examples are for PC/REXX only.───────────────────*/ /*──────────────────────────────────────────────────────────────────────*/
call cursor 3,6 /*move the cursor to row 3, col 6*/ say 'Hello' /*write the text at that location*/
call scrwrite 30,50,'Hello.' /*another method. */
call scrwrite 40,60,'Hello.',,,14 /*another ... in yellow.*/ </lang>
Retro
<lang Retro>with console'
- hello 3 6 at-xy "Hello" puts ;</lang>
Tcl
<lang tcl>exec tput cup 6 3 >/dev/tty puts "Hello"</lang>