Here - 1000 BiT
Here - 1000 BiT Here - 1000 BiT
LESSON 27SWITCHING NUMBERS WITH STRINGSThis lesson explains two functions: VAL( ) and STR$( ).MAKING STRINGS INTO NUMBERSWe have two kinds of variables: strings and numbers. We can change one kind into theother.Run10 REM STRINGS INTO NUMBERS20 PRINT'clr"30L$="123":M$="789"50 L=VAL(L$):M=VAL(M$)70 PRINT L72 PRINT M74 PRINT "76 PRINT L+MVAL stands for value. It changes a string to a number, if it can.152
MAKING NUMBERS INTO STRINGSRun10 REM NUMBERS INTO STRINGS20 PRINT "clr"21 POKE 53281,025 INPUT" GIVE ME A NUMBER ";NB30 N$=STR$[NB)35 L=LEN(N$)40FORI=LTO1 STEP-145B$=B$+MID$(N$,I,1)50 NEXT I60 PRINT "cyn dn HERE IT IS BACKWARDS dn"65 PRINT "dn";B$STR$ stands for string. It changes a number to a string.FUNCTIONS AGAINIn this book we use these functions:RND() INT()LEFT$() RIGHT$() MID$()VAL() STR$()ASC() CHR$() PEEK()LEN()153
- Page 101 and 102: LESSON 17FOR-NEXT LOOPSRemember the
- Page 103 and 104: LOOP VARIABLESTo make sure that eac
- Page 105 and 106: ^ INSTRUCTOR NOTES 18 DATA, READ, R
- Page 107 and 108: STRANGE RULES1. It doesn't matter w
- Page 109 and 110: MIXTURES OF DATAThe DATA statement
- Page 111 and 112: LESSON 19SOUND EFFECTSTurn up the s
- Page 113 and 114: TONES BY THE BUSHELEnter: 10 REM **
- Page 115 and 116: "TM" stands for "timbre." Timbre is
- Page 117 and 118: INSTRUCTOR NOTES 20NAMES, CLOCKS AN
- Page 119 and 120: cAnytimeyou type, the characters ar
- Page 121 and 122: LESSON 21COLOR GRAPHICSADJUST YOUR
- Page 123 and 124: Add these lines to the above progra
- Page 125 and 126: INSTRUCTOR NOTES 22POKEing GRAPHICS
- Page 127 and 128: Try this: Change the number 83 to a
- Page 129 and 130: We can number the streets and house
- Page 131 and 132: n INSTRUCTOR NOTES 23 SECRET WRITIN
- Page 133 and 134: THE COMPUTER ISIMPATIENTThe compute
- Page 135 and 136: ^ INSTRUCTOR NOTES 24 PRETTY PROGRA
- Page 137 and 138: Assignment 24A:1. The delay loop is
- Page 139 and 140: Assignment 24B:1. Write a short pro
- Page 141 and 142: LESSON 25 LOGIC: AND, OR, NOTANOTHE
- Page 143 and 144: THE IF COMMAND TELLS LITTLE WHITE L
- Page 145 and 146: THE LOGIC SIGNSYou can use these si
- Page 147 and 148: LESSON 26 SNIPPING STRINGS: LEFTS,
- Page 149 and 150: CUTTING A PIECE OUT OF THE MIDDLETh
- Page 151: nnO INSTRUCTOR NOTES 27 SWITCHING N
- Page 155 and 156: Assignment 27:1. Write a program wh
- Page 157 and 158: LESSON 28ACTION GAMES AND THE FUNCT
- Page 159 and 160: LOOKING IN THE KEYBOARD'S BOXHere i
- Page 161 and 162: Run it. It puts a white diamond on
- Page 163 and 164: cTHETARGETS ARE HEARTSAdd these lin
- Page 165 and 166: LESSON 29MUSICGo back and review th
- Page 167 and 168: REGISTER ADDRESSES Base address is
- Page 169 and 170: D^ INSTRUCTOR NOTES 30 ARRAYS AND T
- Page 171 and 172: The DIM... command tells the comput
- Page 173 and 174: 1 REM *** EIGHT QUEENS ***2 GOTO 10
- Page 175 and 176: Assignment 30:1. Write a program wh
- Page 177 and 178: LESSON 31SPRITES FOR ACTION GRAPHIC
- Page 179 and 180: Then use the CRSR keys to move the
- Page 181 and 182: MANY SPRITES AT ONCEHere are the bo
- Page 183 and 184: WATCH OUT, TWO SPRITES ARE GOING TO
- Page 185 and 186: LESSON 32USER FRIENDLY PROGRAMSTher
- Page 187 and 188: TIE A STRING AROUND THE USER'S FING
- Page 189 and 190: SET TRAPS FOR ERRORSExample: Add th
- Page 191 and 192: LESSON 33DEBUGGING, STOP, CONTTHE S
- Page 193 and 194: Use the PRINT command to look at va
- Page 195 and 196: RESERVED WORDSABSAND ASC ATNCHR$CLR
- Page 197 and 198: ells and whistlesA phrase going bac
- Page 199 and 200: error trapPart of a program which c
- Page 201 and 202: listingA list of all the lines in a
MAKING NUMBERS INTO STRINGSRun10 REM NUMBERS INTO STRINGS20 PRINT "clr"21 POKE 53281,025 INPUT" GIVE ME A NUMBER ";NB30 N$=STR$[NB)35 L=LEN(N$)40FORI=LTO1 STEP-145B$=B$+MID$(N$,I,1)50 NEXT I60 PRINT "cyn dn HERE IT IS BACKWARDS dn"65 PRINT "dn";B$STR$ stands for string. It changes a number to a string.FUNCTIONS AGAINIn this book we use these functions:RND() INT()LEFT$() RIGHT$() MID$()VAL() STR$()ASC() CHR$() PEEK()LEN()153