Terminal control/Cursor positioning: Difference between revisions
m (→{{header|REXX}}: whitespace/semantic annotations) |
No edit summary |
||
Line 4: | Line 4: | ||
[[Terminal Control::task| ]] |
[[Terminal Control::task| ]] |
||
=={{header|BASIC}}== |
=={{header|BASIC}}== |
||
=== {{header|Applesoft Basic}} === |
|||
<lang Applesoft BASIC> 10 VTAB 6: HTAB 3 |
|||
20 PRINT "HELLO"</lang> |
|||
=== {{header|Locomotive Basic}} === |
=== {{header|Locomotive Basic}} === |
Revision as of 00:31, 30 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
Applesoft Basic
<lang Applesoft BASIC> 10 VTAB 6: HTAB 3
20 PRINT "HELLO"</lang>
Locomotive Basic
<lang locobasic> 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.
<lang rexx>/*REXX program demonstrates cursor position and writing of text to same.*/
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>