Example: The following program TSTRING is identical to TINPUT, except that it converts the program result to a string and appends a labeling string to it.

Program:

Comments:

 

 

«

 

"Key in a, b"

Converts the result to a string.

{ ":a::b:" {1 0} V}

Enters the labeling strings.

INPUT OBJ→

 

TORSA

 

→STR

 

"Area = "

 

SWAP +

Swaps and adds the two strings.

CLLCD 1 DISP

Displays the resultant string,

3 FREEZE

without its delimiters, in line 1 of

 

the display.

»

 

 

 

`OTSTRING

Stores the program in TSTRING.

 

 

 

Execute TSTRING to calculate the area of the torus with a = 1.5 and b = 1.85. The labeled answer appears in the status area.

@·J%TSTRI%

1.5 ˜1.85 `

Pausing to Display Output

To pause to display a result:

1.Enter commands to set up the display.

2.Enter the number of seconds you want to pause.

3.Enter the WAIT command (PRG IN menu).

WAIT suspends execution for the number of seconds in level 1. You can use WAIT with DISP to display messages during program execution — for example, to display intermediate program results. (WAIT interprets arguments 0 and –1 differently — see “Using WAIT for Keystroke Input” on page 148.)

Using MSGBOX to Display Output

To set up a message box:

1.Enter a message string.

2.Execute the MSGBOX command.

Example: Enter the string "HELLO, WORLD" `.

Execute MSGBOX (!°L %OUT% %MSGBO%).

The following message appears:

RPL Programming 151

Page 75
Image 75
HP 48gII Graphing Pausing to Display Output, Using Msgbox to Display Output, `Otstring ‰, To pause to display a result