HP 48gII Advanced User's Reference Manual page 95

Graphing calculator
Hide thumbs Also See for 48gII:
Table of Contents

Advertisement

MNX program listing
Program:
«
{{ "MAX"
« 10 SF CONT » }
{ "MIN"
« 10 CF CONT » }}
TMENU
"Sort for MAX or MIN?"
PROMPT
1 GETI
DO
ROT ROT GETI
4 ROLL DUP2
IF
> 10 FS? XOR
THEN
SWAP
END
DROP
UNTIL
-64 FS?
END
SWAP DROP 0 MENU
»
`OMNX K
Checksum: # 20991d
Bytes:
194.5
Example: Find the maximum element of the following matrix:
Enter the matrix.
Comments:
Defines the option menu. %MAX% sets
flag 10 and continues execution. %MIN%
clears flag 10 and continues execution.
prompt message.
Gets the first element of the array.
Begins the DO loop.
Puts the index and the array in levels 1
and 2, then gets the new array element.
Moves the current minimum or
maximum array element from level 4
below 1, then copies both.
Tests the combined state of the relative
value of the two elements and the status
of flag 10.
If the new element is either less than
the current maximum or greater than
the current minimum, swaps the new
element into level 1.
Drops the other element off the stack.
Begins the DO test-clause.
Tests if flag
reached the end of the array.
Ends the DO loop.
Swaps the index to level 1 and drops it.
Restores the last menu.
Stores the program in MNX.
12 56
45 1
9 14
Displays the temporary menu and a
64 is set — if the index
RPL Programming Examples 2-17

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

49g+

Table of Contents