beautypg.com

Rockwell Automation 1771-DB Basic Module User Manual - Series A User Manual

Page 114

background image

Operating Functions

Chapter 5

5–77

Example program 1:

uLIST
10

REM STRING ALLOCATION COMPUTATION KNOWING:

20

REM 1)# CHARACTERS IN LONGEST STRING 2)# OF STRING VARIABLES

30

PRINT : PRINT

40

INPUT “HOW MANY CHARACTERS IN YOUR LONGEST STRING”C

50

INPUT “HOW MANY STRING VARIABLES WILL YOU NEED”V

60

PRINT

70

N=(((C+1)*V)+1) : REM COMPUTE THE # OF BYTES OF MEMORY NEEDED

80

PRINT: PRINT

90

PRINT “YOU NEED TO ALLOCATE”,N,“BYTES OF MEMORY FOR”,V,“VARIABLES

100

PRINT ”CONTAINING”,C,“CHARACTERS EACH”

110

PRINT : PRINT

120

PRINT“

STRING”,N“,”,C

130

END

uRUN

HOW MANY CHARACTERS IN YOUR LONGEST STRING
?21
HOW MANY VARIABLES WILL YOU NEED
?15

YOU NEED TO ALLOCATE 331 BYTES OF MEMORY FOR 15 VARIABLES CONTAINING
21 CHARACTERS EACH

STRING 331, 21

READY

5.10.3
String Support Calls
(continued)