HP Business BASIC/XL Reference Manual - HP 3000 MPE/iX Computer Systems - Edition 1 (32715-90001)

5-9
Examples
OPTION BASE 1 is assumed.
The following shows several examples of the result of the COL function on
arrays A, B,C,D,E, and F.
A(2,2): 1 2 B(2,4): 1 2 3 4 C(4,3,2): 1 2 0 4 0 0 1 2
4 5 5 6 7 8 5 1 1 0 4 5 0 0
2 0 3 2 1 2 0 1
D(3,3): 1 0 1 E(2,2): 8 3 F(5): 5 4 3 2 1
3 5 7 4 7
9 0 9
COL(A) = 2
COL(B) = 4
COL(C) = 2
COL(D) = 3
COL(E) = 2
COL(F) = 1
COMPRESS$
The COMPRESS$ function returns a copy of string in which a single blank
space replaces each run of blank spaces.
Syntax
COMPRESS$(
S
$)
Parameters
S$ A string expression to be compressed.
Examples
10 A$ = COMPRESS$("c a t") !A$ = "c a t"
COS
The COS function returns the cosine of a number. The result is a real
number. The argument and result can be expressed in angular units of
degrees, grads, or radians.
Syntax
COS(
n
)
Parameters
n
The number that is to be evaluated. This is a REAL
number.
Examples
10 A = COS(45) !A = .71 (Degrees)
20 B = COS(45) !B = .76 (Grads)
30 C = COS(45) !C = .53 (Radians)
CPOS
The CPOS function returns the column position of the cursor in display
memory. For terminals that have a display 80 columns wide, a value in
the range 1..80 is returned. A return value of 1 corresponds to the
leftmost column and a return value of 80 corresponds to the rightmost
column. The program fragment:
100 CURSOR (,45) ! Position cursor to column 45
120 PRINT CPOS ! Prints position of the cursor in display memory
prints the number 45. CPOS determines the cursor position by reading it
from the terminal. Therefore, typing on the keyboard while a CPOS
statement is executing may cause an error.