home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / msdos / basic / basman1.arc / CHAP5.DOC < prev    next >
Unknown  |  1987-12-12  |  26.5 KB

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was not able to be converted.
This format is not currently supported by dexvert.

ConfidenceProgramDetectionMatch TypeSupport
1% dexvert WANG Integrated Word Processor (document/wangIWP) ext Unsupported
1% dexvert Excellence! Document (document/excellenceDocument) ext Unsupported
1% dexvert Norton Textra Writer (document/textraWriter) ext Unsupported
1% dexvert IBM DisplayWrite Document (document/ibmDisplayWriteDocument) ext Unsupported
100% file data default



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 1b 32 1b 55 00 1b 36 1b | 38 1b 41 0c 1b 32 1b 47 |.2.U..6.|8.A..2.G|
|00000010| 1b 43 42 0d 0a 0d 0a 0d | 0a 0d 0a 20 20 20 20 20 |.CB.....|... |
|00000020| 1b 45 43 48 41 50 54 45 | 52 20 35 1b 46 20 20 20 |.ECHAPTE|R 5.F |
|00000030| 20 20 20 20 20 20 20 20 | 20 20 20 20 1b 45 49 4e | | .EIN|
|00000040| 54 45 52 41 43 54 49 56 | 45 20 50 52 4f 47 52 41 |TERACTIV|E PROGRA|
|00000050| 4d 4d 49 4e 47 1b 46 20 | 20 20 20 20 20 20 20 20 |MMING.F | |
|00000060| 20 20 20 20 20 20 20 1b | 45 43 48 41 50 54 45 52 | .|ECHAPTER|
|00000070| 20 35 0d 0a 0d 0a 0d 0a | 20 20 20 20 20 1b 46 54 | 5......| .FT|
|00000080| 68 65 20 70 72 6f 67 72 | 61 6d 73 20 77 65 20 68 |he progr|ams we h|
|00000090| 61 76 65 20 77 72 69 74 | 74 65 6e 20 73 6f 20 66 |ave writ|ten so f|
|000000a0| 61 72 20 61 6c 6c 20 75 | 73 65 64 20 44 41 54 41 |ar all u|sed DATA|
|000000b0| 20 73 74 61 74 65 6d 65 | 6e 74 73 20 74 6f 20 73 | stateme|nts to s|
|000000c0| 74 6f 72 65 0d 0a 20 20 | 20 20 20 64 61 74 61 20 |tore.. | data |
|000000d0| 69 6e 74 65 72 6e 61 6c | 6c 79 2e 20 20 50 72 6f |internal|ly. Pro|
|000000e0| 64 75 63 74 69 6f 6e 20 | 70 72 6f 67 72 61 6d 73 |duction |programs|
|000000f0| 20 64 6f 6e 27 74 20 77 | 6f 72 6b 20 74 68 69 73 | don't w|ork this|
|00000100| 20 77 61 79 2e 20 20 49 | 74 20 69 73 20 76 65 72 | way. I|t is ver|
|00000110| 79 0d 0a 20 20 20 20 20 | 69 6e 65 66 66 69 63 69 |y.. |ineffici|
|00000120| 65 6e 74 20 74 6f 20 63 | 68 61 6e 67 65 20 73 6f |ent to c|hange so|
|00000130| 75 72 63 65 20 63 6f 64 | 65 20 65 76 65 72 79 20 |urce cod|e every |
|00000140| 74 69 6d 65 20 64 61 74 | 61 20 63 68 61 6e 67 65 |time dat|a change|
|00000150| 73 2e 20 20 4f 75 72 20 | 6e 65 78 74 0d 0a 20 20 |s. Our |next.. |
|00000160| 20 20 20 74 61 73 6b 20 | 69 73 20 74 6f 20 73 65 | task |is to se|
|00000170| 70 61 72 61 74 65 20 74 | 68 65 20 64 61 74 61 20 |parate t|he data |
|00000180| 66 72 6f 6d 20 74 68 65 | 20 6c 6f 67 69 63 20 61 |from the| logic a|
|00000190| 6e 64 20 6c 65 74 20 74 | 68 65 20 65 6e 64 20 75 |nd let t|he end u|
|000001a0| 73 65 72 0d 0a 20 20 20 | 20 20 6d 61 69 6e 74 61 |ser.. | mainta|
|000001b0| 69 6e 20 74 68 65 20 66 | 6f 72 6d 65 72 2e 20 20 |in the f|ormer. |
|000001c0| 54 68 69 73 20 69 73 20 | 61 63 63 6f 6d 70 6c 69 |This is |accompli|
|000001d0| 73 68 65 64 20 74 68 72 | 6f 75 67 68 20 69 6e 74 |shed thr|ough int|
|000001e0| 65 72 61 63 74 69 76 65 | 2c 20 6f 72 0d 0a 20 20 |eractive|, or.. |
|000001f0| 20 20 20 63 6f 6e 76 65 | 72 73 61 74 69 6f 6e 61 | conve|rsationa|
|00000200| 6c 2c 20 70 72 6f 67 72 | 61 6d 73 20 74 68 61 74 |l, progr|ams that|
|00000210| 20 69 6e 74 65 72 66 61 | 63 65 20 77 69 74 68 20 | interfa|ce with |
|00000220| 75 73 65 72 73 20 76 69 | 61 20 6b 65 79 62 6f 61 |users vi|a keyboa|
|00000230| 72 64 20 69 6e 70 75 74 | 2e 0d 0a 20 20 20 20 20 |rd input|... |
|00000240| 59 65 73 2c 20 79 6f 75 | 20 74 6f 6f 20 63 61 6e |Yes, you| too can|
|00000250| 20 74 61 6c 6b 20 74 6f | 20 79 6f 75 72 20 63 6f | talk to| your co|
|00000260| 6d 70 75 74 65 72 2e 0d | 0a 0d 0a 0d 0a 20 20 20 |mputer..|..... |
|00000270| 20 20 1b 45 49 4e 50 55 | 54 0d 0a 0d 0a 20 20 20 | .EINPU|T.... |
|00000280| 20 20 1b 46 53 69 6e 63 | 65 20 64 61 74 61 20 69 | .FSinc|e data i|
|00000290| 73 20 6e 6f 74 20 62 65 | 69 6e 67 20 73 74 6f 72 |s not be|ing stor|
|000002a0| 65 64 20 61 73 20 70 61 | 72 74 20 6f 66 20 74 68 |ed as pa|rt of th|
|000002b0| 65 20 70 72 6f 67 72 61 | 6d 20 77 65 20 61 6c 74 |e progra|m we alt|
|000002c0| 65 72 6e 61 74 69 76 65 | 73 0d 0a 20 20 20 20 20 |ernative|s.. |
|000002d0| 74 6f 20 44 41 54 41 20 | 73 74 61 74 65 6d 65 6e |to DATA |statemen|
|000002e0| 74 73 2e 20 20 52 45 41 | 44 20 73 74 61 74 65 6d |ts. REA|D statem|
|000002f0| 65 6e 74 73 20 61 72 65 | 20 6f 75 74 20 61 73 20 |ents are| out as |
|00000300| 77 65 6c 6c 20 73 69 6e | 63 65 20 74 68 65 73 65 |well sin|ce these|
|00000310| 0d 0a 20 20 20 20 20 72 | 65 74 72 69 65 76 65 20 |.. r|etrieve |
|00000320| 73 74 6f 72 65 64 20 64 | 61 74 61 2e 20 20 54 68 |stored d|ata. Th|
|00000330| 65 20 61 73 74 75 74 65 | 20 72 65 61 64 65 72 20 |e astute| reader |
|00000340| 68 61 73 20 61 6c 72 65 | 61 64 79 20 73 75 72 6d |has alre|ady surm|
|00000350| 69 73 65 64 20 74 68 61 | 74 20 77 68 61 74 0d 0a |ised tha|t what..|
|00000360| 20 20 20 20 20 77 65 20 | 61 72 65 20 67 6f 69 6e | we |are goin|
|00000370| 67 20 74 6f 20 75 73 65 | 20 69 73 20 74 68 65 20 |g to use| is the |
|00000380| 49 4e 50 55 54 20 73 74 | 61 74 65 6d 65 6e 74 2e |INPUT st|atement.|
|00000390| 20 20 57 68 79 20 65 6c | 73 65 20 77 6f 75 6c 64 | Why el|se would|
|000003a0| 20 69 74 20 62 65 20 74 | 68 65 0d 0a 20 20 20 20 | it be t|he.. |
|000003b0| 20 68 65 61 64 69 6e 67 | 20 66 6f 72 20 74 68 69 | heading| for thi|
|000003c0| 73 20 70 61 72 61 67 72 | 61 70 68 2e 20 20 49 4e |s paragr|aph. IN|
|000003d0| 50 55 54 20 74 65 6c 6c | 73 20 74 68 65 20 63 6f |PUT tell|s the co|
|000003e0| 6d 70 75 74 65 72 20 74 | 68 65 20 66 6f 6c 6c 6f |mputer t|he follo|
|000003f0| 77 69 6e 67 2c 0d 0a 20 | 20 20 20 20 22 64 61 74 |wing,.. | "dat|
|00000400| 61 20 77 69 6c 6c 20 63 | 6f 6d 65 20 66 72 6f 6d |a will c|ome from|
|00000410| 20 74 68 65 20 6b 65 79 | 62 6f 61 72 64 20 61 6e | the key|board an|
|00000420| 64 20 77 69 6c 6c 20 63 | 6f 6e 74 69 6e 75 65 20 |d will c|ontinue |
|00000430| 75 6e 74 69 6c 20 61 20 | 63 61 72 72 69 61 67 65 |until a |carriage|
|00000440| 0d 0a 20 20 20 20 20 72 | 65 74 75 72 6e 20 28 45 |.. r|eturn (E|
|00000450| 6e 74 65 72 29 20 69 73 | 20 72 65 63 65 69 76 65 |nter) is| receive|
|00000460| 64 22 3a 0d 0a 0d 0a 20 | 20 20 20 20 34 35 30 20 |d":.... | 450 |
|00000470| 49 4e 50 55 54 20 4c 41 | 53 54 2e 4e 41 4d 45 24 |INPUT LA|ST.NAME$|
|00000480| 2c 20 41 47 45 0d 0a 0d | 0a 20 20 20 20 20 57 68 |, AGE...|. Wh|
|00000490| 65 6e 20 79 6f 75 72 20 | 70 72 6f 67 72 61 6d 20 |en your |program |
|000004a0| 65 78 65 63 75 74 65 73 | 2c 20 69 74 20 77 69 6c |executes|, it wil|
|000004b0| 6c 20 73 74 6f 70 20 61 | 74 20 6c 69 6e 65 20 34 |l stop a|t line 4|
|000004c0| 35 30 20 61 6e 64 20 70 | 72 69 6e 74 20 61 0d 0a |50 and p|rint a..|
|000004d0| 20 20 20 20 20 71 75 65 | 73 74 69 6f 6e 20 6d 61 | que|stion ma|
|000004e0| 72 6b 20 28 3f 29 20 6f | 6e 20 74 68 65 20 73 63 |rk (?) o|n the sc|
|000004f0| 72 65 65 6e 2e 20 20 42 | 61 73 65 64 20 6f 6e 20 |reen. B|ased on |
|00000500| 74 68 65 20 61 62 6f 76 | 65 20 63 6f 64 65 2c 20 |the abov|e code, |
|00000510| 74 68 65 20 6c 6f 67 69 | 63 0d 0a 20 20 20 20 20 |the logi|c.. |
|00000520| 65 78 70 65 63 74 73 20 | 74 77 6f 20 70 69 65 63 |expects |two piec|
|00000530| 65 73 20 6f 66 20 69 6e | 70 75 74 3b 20 61 20 73 |es of in|put; a s|
|00000540| 74 72 69 6e 67 2c 20 61 | 6e 64 20 61 20 6e 75 6d |tring, a|nd a num|
|00000550| 65 72 69 63 2e 20 20 54 | 68 65 20 64 61 74 61 20 |eric. T|he data |
|00000560| 77 69 6c 6c 20 62 65 0d | 0a 20 20 20 20 20 61 73 |will be.|. as|
|00000570| 73 69 67 6e 65 64 20 74 | 6f 20 74 68 65 20 76 61 |signed t|o the va|
|00000580| 72 69 61 62 6c 65 73 20 | 4c 41 53 54 2e 4e 41 4d |riables |LAST.NAM|
|00000590| 45 24 20 61 6e 64 20 41 | 47 45 20 72 65 73 70 65 |E$ and A|GE respe|
|000005a0| 63 74 69 76 65 6c 79 2e | 20 20 4f 6e 20 65 6e 74 |ctively.| On ent|
|000005b0| 72 79 2c 0d 0a 20 20 20 | 20 20 69 74 20 6d 75 73 |ry,.. | it mus|
|000005c0| 74 20 62 65 20 73 65 70 | 61 72 61 74 65 64 20 62 |t be sep|arated b|
|000005d0| 79 20 63 6f 6d 6d 61 73 | 3a 0d 0a 0d 0a 20 20 20 |y commas|:.... |
|000005e0| 20 20 3f 20 41 55 54 48 | 4f 52 2c 32 37 0d 0a 0d | ? AUTH|OR,27...|
|000005f0| 0a 20 20 20 20 20 4e 6f | 74 20 65 78 74 72 65 6d |. No|t extrem|
|00000600| 65 6c 79 20 6d 65 61 6e | 69 6e 67 66 75 6c 2c 20 |ely mean|ingful, |
|00000610| 69 73 20 69 74 3f 20 20 | 48 6f 77 20 64 6f 65 73 |is it? |How does|
|00000620| 20 61 6e 79 62 6f 64 79 | 20 6b 6e 6f 77 20 77 68 | anybody| know wh|
|00000630| 61 74 20 74 6f 20 70 75 | 74 0d 0a 20 20 20 20 20 |at to pu|t.. |
|00000640| 61 66 74 65 72 20 74 68 | 65 20 71 75 65 73 74 69 |after th|e questi|
|00000650| 6f 6e 20 6d 61 72 6b 3f | 20 20 4f 6e 20 74 6f 70 |on mark?| On top|
|00000660| 20 6f 66 20 74 68 61 74 | 2c 20 77 69 74 68 6f 75 | of that|, withou|
|00000670| 74 20 6b 6e 6f 77 69 6e | 67 20 74 68 65 20 63 6f |t knowin|g the co|
|00000680| 64 65 2c 20 61 0d 0a 20 | 20 20 20 20 70 65 72 73 |de, a.. | pers|
|00000690| 6f 6e 20 68 61 73 20 6e | 6f 20 69 64 65 61 20 6f |on has n|o idea o|
|000006a0| 66 20 68 6f 77 20 6d 61 | 6e 79 20 65 6e 74 72 69 |f how ma|ny entri|
|000006b0| 65 73 20 74 68 65 20 70 | 72 6f 67 72 61 6d 20 65 |es the p|rogram e|
|000006c0| 78 70 65 63 74 73 2e 20 | 20 42 79 20 69 74 73 65 |xpects. | By itse|
|000006d0| 6c 66 2c 0d 0a 20 20 20 | 20 20 74 68 65 20 49 4e |lf,.. | the IN|
|000006e0| 50 55 54 20 73 74 61 74 | 65 6d 65 6e 74 20 69 73 |PUT stat|ement is|
|000006f0| 20 73 6f 6d 65 77 68 61 | 74 20 63 6c 75 6d 73 79 | somewha|t clumsy|
|00000700| 2e 20 20 57 65 20 6e 65 | 65 64 20 61 20 70 72 6f |. We ne|ed a pro|
|00000710| 6d 70 74 20 74 68 61 74 | 20 73 61 79 73 0d 0a 20 |mpt that| says.. |
|00000720| 20 20 20 20 22 67 69 76 | 65 20 6d 65 20 61 20 6c | "giv|e me a l|
|00000730| 61 73 74 20 6e 61 6d 65 | 20 61 6e 64 20 61 6e 20 |ast name| and an |
|00000740| 61 67 65 22 2e 20 20 54 | 68 69 73 2c 20 69 74 20 |age". T|his, it |
|00000750| 74 75 72 6e 73 20 6f 75 | 74 2c 20 69 73 20 61 6e |turns ou|t, is an|
|00000760| 20 65 61 73 79 20 74 61 | 73 6b 2e 0d 0a 20 20 20 | easy ta|sk... |
|00000770| 20 20 59 6f 75 20 70 75 | 74 20 61 20 70 72 6f 6d | You pu|t a prom|
|00000780| 70 74 2c 20 65 6e 63 6c | 6f 73 65 64 20 69 6e 20 |pt, encl|osed in |
|00000790| 71 75 6f 74 61 74 69 6f | 6e 20 6d 61 72 6b 73 2c |quotatio|n marks,|
|000007a0| 20 61 66 74 65 72 20 74 | 68 65 20 49 4e 50 55 54 | after t|he INPUT|
|000007b0| 0d 0a 20 20 20 20 20 73 | 74 61 74 65 6d 65 6e 74 |.. s|tatement|
|000007c0| 20 61 6e 64 20 61 20 73 | 65 6d 69 63 6f 6c 6f 6e | and a s|emicolon|
|000007d0| 20 61 66 74 65 72 20 74 | 68 65 20 70 72 6f 6d 70 | after t|he promp|
|000007e0| 74 2e 20 20 4c 69 6e 65 | 20 34 35 30 20 6e 6f 77 |t. Line| 450 now|
|000007f0| 20 6c 6f 6f 6b 73 20 6c | 69 6b 65 0d 0a 20 20 20 | looks l|ike.. |
|00000800| 20 20 74 68 69 73 3a 0d | 0a 0d 0a 20 20 20 20 20 | this:.|... |
|00000810| 34 35 30 20 49 4e 50 55 | 54 20 22 45 4e 54 45 52 |450 INPU|T "ENTER|
|00000820| 20 4c 41 53 54 20 4e 41 | 4d 45 20 41 4e 44 20 41 | LAST NA|ME AND A|
|00000830| 47 45 22 3b 20 4c 41 53 | 54 2e 4e 41 4d 45 24 2c |GE"; LAS|T.NAME$,|
|00000840| 20 41 47 45 0d 0a 0d 0a | 20 20 20 20 20 4e 65 76 | AGE....| Nev|
|00000850| 65 72 20 75 73 65 20 63 | 6f 6e 76 65 72 73 61 74 |er use c|onversat|
|00000860| 69 6f 6e 61 6c 20 69 6e | 70 75 74 73 20 77 69 74 |ional in|puts wit|
|00000870| 68 6f 75 74 20 67 69 76 | 69 6e 67 20 6d 65 61 6e |hout giv|ing mean|
|00000880| 69 6e 67 66 75 6c 20 70 | 72 6f 6d 70 74 73 2e 0d |ingful p|rompts..|
|00000890| 0a 20 20 20 20 20 57 68 | 79 3f 20 20 42 65 63 61 |. Wh|y? Beca|
|000008a0| 75 73 65 20 79 6f 75 72 | 20 70 72 6f 67 72 61 6d |use your| program|
|000008b0| 20 69 73 20 75 73 65 6c | 65 73 73 20 75 6e 6c 65 | is usel|ess unle|
|000008c0| 73 73 20 74 68 65 20 70 | 65 72 73 6f 6e 20 62 65 |ss the p|erson be|
|000008d0| 68 69 6e 64 20 74 68 65 | 0d 0a 20 20 20 20 20 6b |hind the|.. k|
|000008e0| 65 79 62 6f 61 72 64 20 | 6b 6e 6f 77 73 20 77 68 |eyboard |knows wh|
|000008f0| 61 74 20 74 6f 20 65 6e | 74 65 72 2e 20 20 57 68 |at to en|ter. Wh|
|00000900| 65 6e 20 6f 75 72 20 70 | 72 6f 67 72 61 6d 20 65 |en our p|rogram e|
|00000910| 78 65 63 75 74 65 73 20 | 77 69 74 68 20 61 20 70 |xecutes |with a p|
|00000920| 72 6f 6d 70 74 2c 0d 0a | 20 20 20 20 20 74 68 65 |rompt,..| the|
|00000930| 20 66 6f 6c 6c 6f 77 69 | 6e 67 20 64 69 61 6c 6f | followi|ng dialo|
|00000940| 67 75 65 20 6f 63 63 75 | 72 73 3a 0d 0a 0d 0a 20 |gue occu|rs:.... |
|00000950| 20 20 20 20 45 4e 54 45 | 52 20 4c 41 53 54 20 4e | ENTE|R LAST N|
|00000960| 41 4d 45 2c 20 41 47 45 | 3f 20 20 41 55 54 48 4f |AME, AGE|? AUTHO|
|00000970| 52 2c 32 37 0d 0a 0d 0a | 20 20 20 20 20 59 6f 75 |R,27....| You|
|00000980| 20 64 6f 6e 27 74 20 68 | 61 76 65 20 74 6f 20 73 | don't h|ave to s|
|00000990| 74 61 63 6b 20 61 6c 6c | 20 74 68 65 20 69 6e 70 |tack all| the inp|
|000009a0| 75 74 20 6f 6e 20 74 68 | 65 20 73 61 6d 65 20 6c |ut on th|e same l|
|000009b0| 69 6e 65 2e 20 20 54 68 | 65 20 70 72 65 76 69 6f |ine. Th|e previo|
|000009c0| 75 73 0d 0a 20 20 20 20 | 20 65 78 61 6d 70 6c 65 |us.. | example|
|000009d0| 20 63 6f 75 6c 64 20 6a | 75 73 74 20 61 73 20 77 | could j|ust as w|
|000009e0| 65 6c 6c 20 68 61 76 65 | 20 62 65 65 6e 20 73 70 |ell have| been sp|
|000009f0| 6c 69 74 20 75 70 20 61 | 73 20 66 6f 6c 6c 6f 77 |lit up a|s follow|
|00000a00| 73 3a 0d 0a 0d 0a 20 20 | 20 20 20 34 35 30 20 49 |s:.... | 450 I|
|00000a10| 4e 50 55 54 20 22 45 4e | 54 45 52 20 4c 41 53 54 |NPUT "EN|TER LAST|
|00000a20| 20 4e 41 4d 45 22 3b 20 | 20 20 4c 41 53 54 2e 4e | NAME"; | LAST.N|
|00000a30| 41 4d 45 24 0d 0a 20 20 | 20 20 20 34 36 30 20 49 |AME$.. | 460 I|
|00000a40| 4e 50 55 54 20 22 45 4e | 54 45 52 20 43 55 52 52 |NPUT "EN|TER CURR|
|00000a50| 45 4e 54 20 41 47 45 22 | 3b 20 41 47 45 0d 0a 0d |ENT AGE"|; AGE...|
|00000a60| 0a 0d 0a 0d 0a 20 20 20 | 20 20 20 20 20 20 20 20 |..... | |
|00000a70| 20 20 20 20 20 20 1b 45 | 20 20 20 20 20 20 20 20 | .E| |
|00000a80| 20 20 20 20 20 20 20 20 | 1b 46 20 20 20 20 20 20 | |.F |
|00000a90| 20 1b 45 20 20 34 39 0d | 0a 0d 0a 0c 0d 0a 0d 0a | .E 49.|........|
|00000aa0| 0d 0a 0d 0a 1b 46 20 20 | 20 20 20 1b 45 43 48 41 |.....F | .ECHA|
|00000ab0| 50 54 45 52 20 35 1b 46 | 20 20 20 20 20 20 20 20 |PTER 5.F| |
|00000ac0| 20 20 20 20 20 20 20 1b | 45 49 4e 54 45 52 41 43 | .|EINTERAC|
|00000ad0| 54 49 56 45 20 50 52 4f | 47 52 41 4d 4d 49 4e 47 |TIVE PRO|GRAMMING|
|00000ae0| 1b 46 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |.F | |
|00000af0| 20 20 1b 45 43 48 41 50 | 54 45 52 20 35 0d 0a 0d | .ECHAP|TER 5...|
|00000b00| 0a 0d 0a 20 20 20 20 20 | 1b 46 49 6e 20 66 61 63 |... |.FIn fac|
|00000b10| 74 2c 20 6f 6e 65 20 69 | 6e 70 75 74 20 70 65 72 |t, one i|nput per|
|00000b20| 20 70 72 6f 6d 70 74 20 | 69 73 20 70 72 65 66 65 | prompt |is prefe|
|00000b30| 72 61 62 6c 65 20 6d 6f | 73 74 20 6f 66 20 74 68 |rable mo|st of th|
|00000b40| 65 20 74 69 6d 65 2e 0d | 0a 0d 0a 20 20 20 20 20 |e time..|... |
|00000b50| 54 69 6d 65 20 66 6f 72 | 20 61 20 70 72 61 63 74 |Time for| a pract|
|00000b60| 69 63 65 20 65 78 65 72 | 63 69 73 65 2e 20 20 4c |ice exer|cise. L|
|00000b70| 65 74 27 73 20 77 72 69 | 74 65 20 61 20 70 72 6f |et's wri|te a pro|
|00000b80| 67 72 61 6d 20 74 68 61 | 74 20 63 61 6c 63 75 6c |gram tha|t calcul|
|00000b90| 61 74 65 73 20 74 68 65 | 0d 0a 20 20 20 20 20 61 |ates the|.. a|
|00000ba0| 72 65 61 20 61 6e 64 20 | 64 69 61 6d 65 74 65 72 |rea and |diameter|
|00000bb0| 20 6f 66 20 61 20 63 69 | 72 63 6c 65 20 67 69 76 | of a ci|rcle giv|
|00000bc0| 65 6e 20 74 68 65 20 72 | 61 64 69 75 73 2e 0d 0a |en the r|adius...|
|00000bd0| 0d 0a 0d 0a 20 20 20 20 | 20 31 30 30 20 27 20 20 |.... | 100 ' |
|00000be0| 20 20 4e 41 4d 45 3a 20 | 20 20 20 20 20 20 20 20 | NAME: | |
|00000bf0| 20 20 43 49 52 43 4c 45 | 0d 0a 20 20 20 20 20 31 | CIRCLE|.. 1|
|00000c00| 31 30 20 27 20 20 20 20 | 57 52 49 54 54 45 4e 20 |10 ' |WRITTEN |
|00000c10| 42 59 3a 20 20 20 20 20 | 54 2e 20 41 55 54 48 4f |BY: |T. AUTHO|
|00000c20| 52 0d 0a 20 20 20 20 20 | 31 32 30 20 27 20 20 20 |R.. |120 ' |
|00000c30| 20 44 41 54 45 20 57 52 | 49 54 54 45 4e 3a 20 20 | DATE WR|ITTEN: |
|00000c40| 20 30 31 2f 30 31 2f 38 | 35 0d 0a 20 20 20 20 20 | 01/01/8|5.. |
|00000c50| 31 33 30 20 27 0d 0a 20 | 20 20 20 20 31 34 30 20 |130 '.. | 140 |
|00000c60| 27 20 20 20 20 54 48 49 | 53 20 49 53 20 41 20 43 |' THI|S IS A C|
|00000c70| 4f 4e 56 45 52 53 41 54 | 49 4f 4e 41 4c 20 50 52 |ONVERSAT|IONAL PR|
|00000c80| 4f 47 52 41 4d 20 54 48 | 41 54 20 43 41 4c 43 55 |OGRAM TH|AT CALCU|
|00000c90| 4c 41 54 45 53 20 54 48 | 45 20 41 52 45 41 20 41 |LATES TH|E AREA A|
|00000ca0| 4e 44 0d 0a 20 20 20 20 | 20 31 35 30 20 27 20 20 |ND.. | 150 ' |
|00000cb0| 20 20 44 49 41 4d 45 54 | 45 52 20 4f 46 20 41 20 | DIAMET|ER OF A |
|00000cc0| 43 49 52 43 4c 45 20 47 | 49 56 45 4e 20 54 48 45 |CIRCLE G|IVEN THE|
|00000cd0| 20 52 41 44 49 55 53 2e | 0d 0a 20 20 20 20 20 31 | RADIUS.|.. 1|
|00000ce0| 36 30 20 27 0d 0a 20 20 | 20 20 20 31 37 30 20 27 |60 '.. | 170 '|
|00000cf0| 20 20 20 20 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a | ****|********|
|00000d00| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 20 20 49 4e 50 55 54 |********|* INPUT|
|00000d10| 20 56 41 52 49 41 42 4c | 45 53 20 20 2a 2a 2a 2a | VARIABL|ES ****|
|00000d20| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000d30| 2a 0d 0a 20 20 20 20 20 | 31 38 30 20 27 0d 0a 20 |*.. |180 '.. |
|00000d40| 20 20 20 20 31 39 30 20 | 27 20 20 20 20 52 41 44 | 190 |' RAD|
|00000d50| 49 55 53 20 2e 2e 2e 2e | 2e 2e 2e 20 20 54 48 45 |IUS ....|... THE|
|00000d60| 20 52 41 44 49 55 53 20 | 4f 46 20 54 48 45 20 43 | RADIUS |OF THE C|
|00000d70| 49 52 43 4c 45 0d 0a 20 | 20 20 20 20 32 30 30 20 |IRCLE.. | 200 |
|00000d80| 27 0d 0a 20 20 20 20 20 | 32 31 30 20 27 20 20 20 |'.. |210 ' |
|00000d90| 20 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a | *******|********|
|00000da0| 2a 2a 2a 2a 2a 2a 20 20 | 4f 54 48 45 52 20 43 4f |****** |OTHER CO|
|00000db0| 4e 53 54 41 4e 54 53 20 | 20 2a 2a 2a 2a 2a 2a 2a |NSTANTS | *******|
|00000dc0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 0d 0a |********|******..|
|00000dd0| 20 20 20 20 20 32 32 30 | 20 27 0d 0a 20 20 20 20 | 220| '.. |
|00000de0| 20 32 33 30 20 27 20 20 | 20 20 50 49 45 20 2e 2e | 230 ' | PIE ..|
|00000df0| 2e 2e 2e 2e 2e 2e 2e 2e | 20 20 4d 41 54 48 45 4d |........| MATHEM|
|00000e00| 41 54 49 43 41 4c 20 56 | 41 4c 55 45 20 46 4f 52 |ATICAL V|ALUE FOR|
|00000e10| 20 50 49 0d 0a 20 20 20 | 20 20 32 34 30 20 27 20 | PI.. | 240 ' |
|00000e20| 20 20 20 41 52 45 41 20 | 2e 2e 2e 2e 2e 2e 2e 2e | AREA |........|
|00000e30| 2e 20 20 54 48 45 20 41 | 52 45 41 20 4f 46 20 54 |. THE A|REA OF T|
|00000e40| 48 45 20 43 49 52 43 4c | 45 20 28 43 41 4c 43 55 |HE CIRCL|E (CALCU|
|00000e50| 4c 41 54 45 44 29 0d 0a | 20 20 20 20 20 32 35 30 |LATED)..| 250|
|00000e60| 20 27 20 20 20 20 44 49 | 41 4d 45 54 45 52 20 2e | ' DI|AMETER .|
|00000e70| 2e 2e 2e 2e 20 20 54 48 | 45 20 44 49 41 4d 45 54 |.... TH|E DIAMET|
|00000e80| 45 52 20 4f 52 20 54 48 | 45 20 43 49 52 43 4c 45 |ER OR TH|E CIRCLE|
|00000e90| 20 28 43 41 4c 43 55 4c | 41 54 45 44 29 0d 0a 20 | (CALCUL|ATED).. |
|00000ea0| 20 20 20 20 32 36 30 20 | 27 0d 0a 20 20 20 20 20 | 260 |'.. |
|00000eb0| 32 37 30 20 27 20 20 20 | 20 2a 2a 2a 2a 2a 2a 2a |270 ' | *******|
|00000ec0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 20 |********|******* |
|00000ed0| 20 49 4e 49 54 49 41 4c | 49 5a 41 54 49 4f 4e 20 | INITIAL|IZATION |
|00000ee0| 20 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a | *******|********|
|00000ef0| 2a 2a 2a 2a 2a 2a 2a 0d | 0a 20 20 20 20 20 32 38 |*******.|. 28|
|00000f00| 30 20 27 0d 0a 20 20 20 | 20 20 32 39 30 20 50 49 |0 '.. | 290 PI|
|00000f10| 45 20 3d 20 33 2e 31 34 | 31 35 39 0d 0a 20 20 20 |E = 3.14|159.. |
|00000f20| 20 20 33 30 30 20 27 0d | 0a 20 20 20 20 20 33 31 | 300 '.|. 31|
|00000f30| 30 20 27 20 20 20 20 2a | 2a 2a 2a 2a 2a 2a 2a 2a |0 ' *|********|
|00000f40| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 20 20 20 |********|***** |
|00000f50| 20 50 52 4f 43 45 53 53 | 49 4e 47 20 20 20 20 2a | PROCESS|ING *|
|00000f60| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000f70| 2a 2a 2a 2a 2a 0d 0a 20 | 20 20 20 20 33 32 30 20 |*****.. | 320 |
|00000f80| 27 0d 0a 20 20 20 20 20 | 33 33 30 20 49 4e 50 55 |'.. |330 INPU|
|00000f90| 54 20 22 57 48 41 54 20 | 49 53 20 54 48 45 20 52 |T "WHAT |IS THE R|
|00000fa0| 41 44 49 55 53 20 4f 46 | 20 59 4f 55 52 20 43 49 |ADIUS OF| YOUR CI|
|00000fb0| 52 43 4c 45 22 3b 20 52 | 41 44 49 55 53 0d 0a 20 |RCLE"; R|ADIUS.. |
|00000fc0| 20 20 20 20 33 33 35 20 | 27 0d 0a 20 20 20 20 20 | 335 |'.. |
|00000fd0| 33 34 30 20 41 52 45 41 | 20 20 20 20 20 3d 20 50 |340 AREA| = P|
|00000fe0| 49 45 20 2a 20 52 41 44 | 49 55 53 20 2a 20 52 41 |IE * RAD|IUS * RA|
|00000ff0| 44 49 55 53 0d 0a 20 20 | 20 20 20 33 35 30 20 44 |DIUS.. | 350 D|
|00001000| 49 41 4d 45 54 45 52 20 | 3d 20 52 41 44 49 55 53 |IAMETER |= RADIUS|
|00001010| 20 2a 20 32 0d 0a 20 20 | 20 20 20 33 36 30 20 50 | * 2.. | 360 P|
|00001020| 52 49 4e 54 0d 0a 20 20 | 20 20 20 33 38 30 20 50 |RINT.. | 380 P|
|00001030| 52 49 4e 54 20 22 54 48 | 45 20 41 52 45 41 20 49 |RINT "TH|E AREA I|
|00001040| 53 3a 20 20 20 20 20 22 | 3b 41 52 45 41 3b 22 20 |S: "|;AREA;" |
|00001050| 53 51 55 41 52 45 20 49 | 4e 43 48 45 53 22 0d 0a |SQUARE I|NCHES"..|
|00001060| 20 20 20 20 20 33 39 30 | 20 50 52 49 4e 54 20 22 | 390| PRINT "|
|00001070| 54 48 45 20 44 49 41 4d | 45 54 45 52 20 49 53 3a |THE DIAM|ETER IS:|
|00001080| 20 22 3b 44 49 41 4d 45 | 54 45 52 3b 22 20 49 4e | ";DIAME|TER;" IN|
|00001090| 43 48 45 53 22 0d 0a 20 | 20 20 20 20 34 30 30 20 |CHES".. | 400 |
|000010a0| 50 52 49 4e 54 0d 0a 20 | 20 20 20 20 34 31 30 20 |PRINT.. | 410 |
|000010b0| 53 54 4f 50 0d 0a 20 20 | 20 20 20 34 32 30 20 45 |STOP.. | 420 E|
|000010c0| 4e 44 0d 0a 0d 0a 0d 0a | 20 20 20 20 20 57 68 79 |ND......| Why|
|000010d0| 20 64 6f 6e 27 74 20 79 | 6f 75 20 73 69 67 6e 20 | don't y|ou sign |
|000010e0| 6f 6e 20 74 6f 20 79 6f | 75 72 20 50 43 2c 20 74 |on to yo|ur PC, t|
|000010f0| 79 70 65 20 69 6e 20 74 | 68 65 20 70 72 6f 67 72 |ype in t|he progr|
|00001100| 61 6d 2c 20 61 6e 64 20 | 73 65 65 20 68 6f 77 20 |am, and |see how |
|00001110| 69 74 0d 0a 20 20 20 20 | 20 72 75 6e 73 2e 20 20 |it.. | runs. |
|00001120| 54 68 65 6e 20 75 73 65 | 20 69 74 20 74 6f 20 63 |Then use| it to c|
|00001130| 61 6c 63 75 6c 61 74 65 | 20 74 68 65 20 61 72 65 |alculate| the are|
|00001140| 61 73 20 61 6e 64 20 64 | 69 61 6d 65 74 65 72 73 |as and d|iameters|
|00001150| 20 6f 66 20 66 6f 75 72 | 20 6f 72 20 66 69 76 65 | of four| or five|
|00001160| 0d 0a 20 20 20 20 20 63 | 69 72 63 6c 65 73 2e 20 |.. c|ircles. |
|00001170| 20 45 6e 74 65 72 20 61 | 20 30 20 66 6f 72 20 6f | Enter a| 0 for o|
|00001180| 6e 65 20 72 75 6e 2c 20 | 61 6e 64 20 61 20 6e 65 |ne run, |and a ne|
|00001190| 67 61 74 69 76 65 20 6e | 75 6d 62 65 72 2c 20 6c |gative n|umber, l|
|000011a0| 69 6b 65 20 2d 33 2c 20 | 66 6f 72 0d 0a 20 20 20 |ike -3, |for.. |
|000011b0| 20 20 61 6e 6f 74 68 65 | 72 20 72 75 6e 2e 0d 0a | anothe|r run...|
|000011c0| 0d 0a 20 20 20 20 20 46 | 69 6e 69 73 68 65 64 20 |.. F|inished |
|000011d0| 64 6f 69 6e 67 20 74 68 | 65 20 61 62 6f 76 65 2c |doing th|e above,|
|000011e0| 20 6f 72 20 64 69 64 20 | 79 6f 75 20 64 65 63 69 | or did |you deci|
|000011f0| 64 65 20 74 6f 20 73 6b | 69 70 20 69 74 3f 20 20 |de to sk|ip it? |
|00001200| 49 66 20 79 6f 75 20 73 | 6b 69 70 70 65 64 0d 0a |If you s|kipped..|
|00001210| 20 20 20 20 20 69 74 2c | 20 67 6f 20 62 61 63 6b | it,| go back|
|00001220| 20 61 6e 64 20 64 6f 20 | 69 74 2e 20 20 52 65 6d | and do |it. Rem|
|00001230| 65 6d 62 65 72 2c 20 63 | 6f 6d 70 75 74 65 72 73 |ember, c|omputers|
|00001240| 20 6b 65 65 70 20 74 72 | 61 63 6b 20 6f 66 20 65 | keep tr|ack of e|
|00001250| 76 65 72 79 20 6d 6f 76 | 65 20 79 6f 75 0d 0a 20 |very mov|e you.. |
|00001260| 20 20 20 20 6d 61 6b 65 | 2e 20 20 42 69 67 20 62 | make|. Big b|
|00001270| 72 6f 74 68 65 72 20 50 | 43 20 69 73 20 77 61 74 |rother P|C is wat|
|00001280| 63 68 69 6e 67 2e 20 20 | 4f 66 66 65 6e 64 69 6e |ching. |Offendin|
|00001290| 67 20 69 74 20 6d 61 79 | 20 72 65 73 75 6c 74 20 |g it may| result |
|000012a0| 69 6e 20 65 78 63 65 73 | 73 0d 0a 20 20 20 20 20 |in exces|s.. |
|000012b0| 61 6e 64 20 73 6f 6d 65 | 74 69 6d 65 73 20 6d 79 |and some|times my|
|000012c0| 73 74 69 63 61 6c 20 73 | 79 6e 74 61 78 20 65 72 |stical s|yntax er|
|000012d0| 72 6f 72 73 2e 20 20 53 | 6f 20 73 74 61 79 20 6f |rors. S|o stay o|
|000012e0| 6e 20 67 6f 6f 64 20 74 | 65 72 6d 73 20 77 69 74 |n good t|erms wit|
|000012f0| 68 20 79 6f 75 72 0d 0a | 20 20 20 20 20 6d 61 63 |h your..| mac|
|00001300| 68 69 6e 65 20 62 79 20 | 70 65 72 66 6f 72 6d 69 |hine by |performi|
|00001310| 6e 67 20 61 6c 6c 20 74 | 68 65 20 65 78 65 72 63 |ng all t|he exerc|
|00001320| 69 73 65 73 20 69 6e 20 | 74 68 69 73 20 62 6f 6f |ises in |this boo|
|00001330| 6b 2e 20 20 4e 6f 74 20 | 64 6f 69 6e 67 20 73 6f |k. Not |doing so|
|00001340| 20 63 61 6e 0d 0a 20 20 | 20 20 20 6c 65 61 64 20 | can.. | lead |
|00001350| 74 6f 20 75 6e 70 72 65 | 64 69 63 74 61 62 6c 65 |to unpre|dictable|
|00001360| 20 72 65 73 75 6c 74 73 | 2e 0d 0a 0d 0a 0d 0a 0d | results|........|
|00001370| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|00001380| 20 20 1b 45 20 20 20 20 | 20 20 20 20 20 20 20 20 | .E | |
|00001390| 20 20 20 20 1b 46 20 20 | 20 20 20 20 20 1b 45 20 | .F | .E |
|000013a0| 20 35 30 0d 0a 0d 0a 0c | 0d 0a 0d 0a 0d 0a 0d 0a | 50.....|........|
|000013b0| 1b 46 20 20 20 20 20 1b | 45 43 48 41 50 54 45 52 |.F .|ECHAPTER|
|000013c0| 20 35 1b 46 20 20 20 20 | 20 20 20 20 20 20 20 20 | 5.F | |
|000013d0| 20 20 20 1b 45 49 4e 54 | 45 52 41 43 54 49 56 45 | .EINT|ERACTIVE|
|000013e0| 20 50 52 4f 47 52 41 4d | 4d 49 4e 47 1b 46 20 20 | PROGRAM|MING.F |
|000013f0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 1b 45 | | .E|
|00001400| 43 48 41 50 54 45 52 20 | 35 0d 0a 0d 0a 0d 0a 0d |CHAPTER |5.......|
|00001410| 0a 20 20 20 20 20 1b 46 | 57 65 20 77 65 72 65 20 |. .F|We were |
|00001420| 67 6f 6e 65 2c 20 77 65 | 27 72 65 20 62 61 63 6b |gone, we|'re back|
|00001430| 20 6e 6f 77 2e 20 20 4c | 65 74 27 73 20 72 65 76 | now. L|et's rev|
|00001440| 69 65 77 20 74 68 65 20 | 72 65 73 75 6c 74 73 20 |iew the |results |
|00001450| 6f 66 20 74 68 65 20 6c | 61 73 74 0d 0a 20 20 20 |of the l|ast.. |
|00001460| 20 20 65 78 65 72 63 69 | 73 65 2e 0d 0a 0d 0a 20 | exerci|se..... |
|00001470| 20 20 20 20 2d 20 45 61 | 63 68 20 74 69 6d 65 20 | - Ea|ch time |
|00001480| 79 6f 75 20 77 61 6e 74 | 65 64 20 74 6f 20 63 61 |you want|ed to ca|
|00001490| 6c 63 75 6c 61 74 65 20 | 74 68 65 20 61 72 65 61 |lculate |the area|
|000014a0| 20 6f 66 20 61 20 63 69 | 72 63 6c 65 2c 20 79 6f | of a ci|rcle, yo|
|000014b0| 75 20 68 61 64 20 74 6f | 0d 0a 20 20 20 20 20 1b |u had to|.. .|
|000014c0| 45 20 20 1b 46 74 65 6c | 6c 20 74 68 65 20 70 72 |E .Ftel|l the pr|
|000014d0| 6f 67 72 61 6d 20 74 6f | 20 27 72 75 6e 27 2e 0d |ogram to| 'run'..|
|000014e0| 0a 20 20 20 20 20 2d 20 | 54 68 65 20 6f 75 74 70 |. - |The outp|
|000014f0| 75 74 20 66 72 6f 6d 20 | 70 72 65 76 69 6f 75 73 |ut from |previous|
|00001500| 20 72 75 6e 73 20 73 74 | 61 79 65 64 20 6f 6e 20 | runs st|ayed on |
|00001510| 74 68 65 20 73 63 72 65 | 65 6e 2c 20 73 63 72 6f |the scre|en, scro|
|00001520| 6c 6c 69 6e 67 20 6f 66 | 66 20 61 73 0d 0a 20 20 |lling of|f as.. |
|00001530| 20 20 20 20 20 74 68 65 | 20 73 63 72 65 65 6e 20 | the| screen |
|00001540| 66 69 6c 6c 65 64 20 75 | 70 2e 0d 0a 20 20 20 20 |filled u|p... |
|00001550| 20 2d 20 54 68 65 20 70 | 72 6f 67 72 61 6d 20 63 | - The p|rogram c|
|00001560| 61 6c 63 75 6c 61 74 65 | 64 20 30 20 6f 72 20 6e |alculate|d 0 or n|
|00001570| 65 67 61 74 69 76 65 20 | 63 69 72 63 6c 65 73 2e |egative |circles.|
|00001580| 0d 0a 20 20 20 20 20 2d | 20 54 68 65 20 6f 75 74 |.. -| The out|
|00001590| 70 75 74 20 61 6c 77 61 | 79 73 20 6c 6f 6f 6b 65 |put alwa|ys looke|
|000015a0| 64 20 6f 66 66 2d 63 65 | 6e 74 65 72 20 62 65 63 |d off-ce|nter bec|
|000015b0| 61 75 73 65 20 69 74 20 | 73 74 61 72 74 65 64 20 |ause it |started |
|000015c0| 69 6e 20 63 6f 6c 75 6d | 6e 20 31 20 6f 66 0d 0a |in colum|n 1 of..|
|000015d0| 20 20 20 20 20 20 20 79 | 6f 75 72 20 73 63 72 65 | y|our scre|
|000015e0| 65 6e 2e 0d 0a 0d 0a 20 | 20 20 20 20 4f 6e 20 74 |en..... | On t|
|000015f0| 68 65 20 70 6f 73 69 74 | 69 76 65 20 73 69 64 65 |he posit|ive side|
|00001600| 2c 20 74 68 65 20 70 72 | 6f 67 72 61 6d 20 65 78 |, the pr|ogram ex|
|00001610| 65 63 75 74 65 64 20 61 | 6e 64 20 70 65 72 66 6f |ecuted a|nd perfo|
|00001620| 72 6d 65 64 20 65 78 61 | 63 74 6c 79 20 77 68 61 |rmed exa|ctly wha|
|00001630| 74 20 77 65 0d 0a 20 20 | 20 20 20 74 6f 6c 64 20 |t we.. | told |
|00001640| 69 74 20 74 6f 20 64 6f | 2c 20 73 6f 20 69 66 20 |it to do|, so if |
|00001650| 77 65 20 63 61 6e 20 66 | 69 78 20 74 68 65 20 70 |we can f|ix the p|
|00001660| 72 6f 62 6c 65 6d 73 20 | 6e 6f 74 65 64 20 61 62 |roblems |noted ab|
|00001670| 6f 76 65 20 77 65 20 77 | 69 6c 6c 20 62 65 20 69 |ove we w|ill be i|
|00001680| 6e 0d 0a 20 20 20 20 20 | 67 6f 6f 64 20 73 68 61 |n.. |good sha|
|00001690| 70 65 2e 0d 0a 0d 0a 20 | 20 20 20 20 49 4e 54 45 |pe..... | INTE|
|000016a0| 52 41 43 54 49 56 45 20 | 4c 4f 4f 50 49 4e 47 0d |RACTIVE |LOOPING.|
|000016b0| 0a 0d 0a 20 20 20 20 20 | 54 6f 20 61 63 68 69 65 |... |To achie|
|000016c0| 76 65 20 6d 75 6c 74 69 | 70 6c 65 20 70 61 73 73 |ve multi|ple pass|
|000016d0| 65 73 2c 20 77 65 20 63 | 61 6e 20 6e 65 73 74 20 |es, we c|an nest |
|000016e0| 74 68 65 20 70 72 6f 67 | 72 61 6d 20 69 6e 73 69 |the prog|ram insi|
|000016f0| 64 65 20 61 20 57 48 49 | 4c 45 20 6c 6f 6f 70 0d |de a WHI|LE loop.|
|00001700| 0a 20 20 20 20 20 74 68 | 61 74 27 73 20 6b 65 79 |. th|at's key|
|00001710| 65 64 20 74 6f 20 61 20 | 71 75 65 73 74 69 6e 67 |ed to a |questing|
|00001720| 20 6c 69 6b 65 20 22 44 | 6f 20 79 6f 75 20 77 61 | like "D|o you wa|
|00001730| 6e 74 20 74 6f 20 67 6f | 20 69 6e 20 61 20 63 69 |nt to go| in a ci|
|00001740| 72 63 6c 65 20 28 79 65 | 73 20 6f 72 0d 0a 20 20 |rcle (ye|s or.. |
|00001750| 20 20 20 6e 6f 29 22 2e | 20 20 41 73 20 6c 6f 6e | no)".| As lon|
|00001760| 67 20 61 73 20 74 68 65 | 20 61 6e 73 77 65 72 20 |g as the| answer |
|00001770| 69 73 20 27 79 65 73 27 | 20 77 65 27 6c 6c 20 6b |is 'yes'| we'll k|
|00001780| 65 65 70 20 6c 6f 6f 70 | 69 6e 67 20 61 6e 64 20 |eep loop|ing and |
|00001790| 65 78 65 63 75 74 69 6e | 67 0d 0a 20 20 20 20 20 |executin|g.. |
|000017a0| 6f 75 72 20 6c 6f 67 69 | 63 2e 20 20 57 65 20 6e |our logi|c. We n|
|000017b0| 65 65 64 20 61 6e 20 49 | 4e 50 55 54 20 6f 75 74 |eed an I|NPUT out|
|000017c0| 73 69 64 65 20 74 68 65 | 20 6c 6f 6f 70 20 61 6e |side the| loop an|
|000017d0| 64 20 61 6e 6f 74 68 65 | 72 20 49 4e 50 55 54 20 |d anothe|r INPUT |
|000017e0| 62 65 66 6f 72 65 0d 0a | 20 20 20 20 20 74 68 65 |before..| the|
|000017f0| 20 57 45 4e 44 2e 20 20 | 54 68 65 20 72 65 73 75 | WEND. |The resu|
|00001800| 6c 74 61 6e 74 20 63 6f | 64 65 20 6c 6f 6f 6b 73 |ltant co|de looks|
|00001810| 20 6c 69 6b 65 20 74 68 | 69 73 3a 0d 0a 0d 0a 20 | like th|is:.... |
|00001820| 20 20 20 20 33 32 30 20 | 27 0d 0a 20 20 20 20 20 | 320 |'.. |
|00001830| 33 32 32 20 49 4e 50 55 | 54 20 22 44 4f 20 59 4f |322 INPU|T "DO YO|
|00001840| 55 20 57 41 4e 54 20 54 | 4f 20 47 4f 20 49 4e 20 |U WANT T|O GO IN |
|00001850| 41 20 43 49 52 43 4c 45 | 20 28 59 45 53 20 4f 52 |A CIRCLE| (YES OR|
|00001860| 20 4e 4f 29 22 3b 20 41 | 4e 53 24 0d 0a 20 20 20 | NO)"; A|NS$.. |
|00001870| 20 20 33 32 34 20 27 0d | 0a 20 20 20 20 20 33 32 | 324 '.|. 32|
|00001880| 36 20 57 48 49 4c 45 20 | 41 4e 53 24 20 3d 20 22 |6 WHILE |ANS$ = "|
|00001890| 59 45 53 22 0d 0a 20 20 | 20 20 20 33 32 38 20 27 |YES".. | 328 '|
|000018a0| 0d 0a 20 20 20 20 20 33 | 33 30 20 20 20 20 49 4e |.. 3|30 IN|
|000018b0| 50 55 54 20 22 57 48 41 | 54 20 49 53 20 54 48 45 |PUT "WHA|T IS THE|
|000018c0| 20 52 41 44 49 55 53 20 | 4f 46 20 59 4f 55 52 20 | RADIUS |OF YOUR |
|000018d0| 43 49 52 43 4c 45 22 3b | 20 52 41 44 49 55 53 0d |CIRCLE";| RADIUS.|
|000018e0| 0a 20 20 20 20 20 33 33 | 38 20 27 0d 0a 20 20 20 |. 33|8 '.. |
|000018f0| 20 20 33 34 30 20 20 20 | 20 41 52 45 41 20 20 20 | 340 | AREA |
|00001900| 20 20 3d 20 50 49 45 20 | 2a 20 52 41 44 49 55 53 | = PIE |* RADIUS|
|00001910| 20 2a 20 52 41 44 49 55 | 53 0d 0a 20 20 20 20 20 | * RADIU|S.. |
|00001920| 33 35 30 20 20 20 20 44 | 49 41 4d 45 54 45 52 20 |350 D|IAMETER |
|00001930| 3d 20 52 41 44 49 55 53 | 20 2a 20 32 0d 0a 20 20 |= RADIUS| * 2.. |
|00001940| 20 20 20 33 35 35 20 27 | 0d 0a 20 20 20 20 20 33 | 355 '|.. 3|
|00001950| 36 30 20 20 20 20 50 52 | 49 4e 54 0d 0a 20 20 20 |60 PR|INT.. |
|00001960| 20 20 33 38 30 20 20 20 | 20 50 52 49 4e 54 20 22 | 380 | PRINT "|
|00001970| 54 48 45 20 41 52 45 41 | 20 49 53 3a 20 20 20 20 |THE AREA| IS: |
|00001980| 20 22 3b 41 52 45 41 3b | 22 20 53 51 55 41 52 45 | ";AREA;|" SQUARE|
|00001990| 20 49 4e 43 48 45 53 22 | 0d 0a 20 20 20 20 20 33 | INCHES"|.. 3|
|000019a0| 39 30 20 20 20 20 50 52 | 49 4e 54 20 22 54 48 45 |90 PR|INT "THE|
|000019b0| 20 44 49 41 4d 45 54 45 | 52 20 49 53 3a 20 22 3b | DIAMETE|R IS: ";|
|000019c0| 44 49 41 4d 45 54 45 52 | 3b 22 20 49 4e 43 48 45 |DIAMETER|;" INCHE|
|000019d0| 53 22 0d 0a 20 20 20 20 | 20 34 30 30 20 20 20 20 |S".. | 400 |
|000019e0| 50 52 49 4e 54 0d 0a 20 | 20 20 20 20 34 30 32 20 |PRINT.. | 402 |
|000019f0| 27 0d 0a 20 20 20 20 20 | 34 30 34 20 20 20 20 49 |'.. |404 I|
|00001a00| 4e 50 55 54 20 22 44 4f | 20 59 4f 55 20 57 41 4e |NPUT "DO| YOU WAN|
|00001a10| 54 20 54 4f 20 4d 41 4b | 45 20 41 4e 4f 54 48 45 |T TO MAK|E ANOTHE|
|00001a20| 52 20 43 49 52 43 4c 45 | 22 3b 20 41 4e 53 24 0d |R CIRCLE|"; ANS$.|
|00001a30| 0a 20 20 20 20 20 34 30 | 36 20 27 0d 0a 20 20 20 |. 40|6 '.. |
|00001a40| 20 20 34 30 38 20 57 45 | 4e 44 0d 0a 0d 0a 20 20 | 408 WE|ND.... |
|00001a50| 20 20 20 41 73 20 79 6f | 75 20 63 61 6e 20 73 65 | As yo|u can se|
|00001a60| 65 2c 20 74 68 69 73 20 | 69 73 20 65 78 61 63 74 |e, this |is exact|
|00001a70| 6c 79 20 74 68 65 20 73 | 61 6d 65 20 74 65 63 68 |ly the s|ame tech|
|00001a80| 6e 69 71 75 65 20 77 65 | 20 75 73 65 64 20 77 68 |nique we| used wh|
|00001a90| 65 6e 20 77 65 0d 0a 20 | 20 20 20 20 63 6f 6d 62 |en we.. | comb|
|00001aa0| 69 6e 65 64 20 74 68 65 | 20 52 45 41 44 20 73 74 |ined the| READ st|
|00001ab0| 61 74 65 6d 65 6e 74 20 | 77 69 74 68 20 74 68 65 |atement |with the|
|00001ac0| 20 57 48 49 4c 45 2e 20 | 20 50 72 6f 67 72 61 6d | WHILE. | Program|
|00001ad0| 6d 69 6e 67 2c 20 6c 69 | 6b 65 20 61 6c 67 65 62 |ming, li|ke algeb|
|00001ae0| 72 61 2c 0d 0a 20 20 20 | 20 20 69 73 20 63 75 6d |ra,.. | is cum|
|00001af0| 75 6c 61 74 69 76 65 2e | 20 20 41 73 20 79 6f 75 |ulative.| As you|
|00001b00| 20 6c 65 61 72 6e 20 6e | 65 77 20 73 6b 69 6c 6c | learn n|ew skill|
|00001b10| 73 20 61 6e 64 20 74 65 | 63 68 6e 69 71 75 65 73 |s and te|chniques|
|00001b20| 20 74 68 65 79 20 61 6c | 77 61 79 73 20 62 75 69 | they al|ways bui|
|00001b30| 6c 64 0d 0a 20 20 20 20 | 20 6f 6e 20 77 68 61 74 |ld.. | on what|
|00001b40| 20 79 6f 75 20 61 6c 72 | 65 61 64 79 20 6b 6e 6f | you alr|eady kno|
|00001b50| 77 2e 0d 0a 0d 0a 20 20 | 20 20 20 54 68 65 72 65 |w..... | There|
|00001b60| 27 73 20 61 20 63 61 76 | 65 61 74 20 68 65 72 65 |'s a cav|eat here|
|00001b70| 2c 20 6d 61 6b 65 20 73 | 75 72 65 20 79 6f 75 20 |, make s|ure you |
|00001b80| 75 6e 64 65 72 73 74 61 | 6e 64 20 61 6e 64 20 63 |understa|nd and c|
|00001b90| 61 6e 20 75 73 65 20 65 | 76 65 72 79 74 68 69 6e |an use e|verythin|
|00001ba0| 67 0d 0a 20 20 20 20 20 | 61 73 20 69 74 27 73 20 |g.. |as it's |
|00001bb0| 63 6f 76 65 72 65 64 2e | 20 20 49 66 20 79 6f 75 |covered.| If you|
|00001bc0| 20 64 6f 6e 27 74 2c 20 | 79 6f 75 27 6c 6c 20 68 | don't, |you'll h|
|00001bd0| 61 76 65 20 70 72 6f 62 | 6c 65 6d 73 20 74 68 72 |ave prob|lems thr|
|00001be0| 6f 75 67 68 20 74 68 65 | 20 72 65 73 74 20 6f 66 |ough the| rest of|
|00001bf0| 0d 0a 20 20 20 20 20 74 | 68 69 73 20 62 6f 6f 6b |.. t|his book|
|00001c00| 2c 20 6f 72 20 66 6f 72 | 20 74 68 61 74 20 6d 61 |, or for| that ma|
|00001c10| 74 74 65 72 20 74 68 72 | 6f 75 67 68 20 79 6f 75 |tter thr|ough you|
|00001c20| 72 20 62 72 69 65 66 20 | 70 72 6f 67 72 61 6d 6d |r brief |programm|
|00001c30| 69 6e 67 20 63 61 72 65 | 65 72 2e 0d 0a 0d 0a 0d |ing care|er......|
|00001c40| 0a 0d 0a 0d 0a 20 20 20 | 20 20 20 20 20 20 20 20 |..... | |
|00001c50| 20 20 20 20 20 20 1b 45 | 20 20 20 20 20 20 20 20 | .E| |
|00001c60| 20 20 20 20 20 20 20 20 | 1b 46 20 20 20 20 20 20 | |.F |
|00001c70| 20 1b 45 20 20 35 31 0d | 0a 0d 0a 0c 0d 0a 0d 0a | .E 51.|........|
|00001c80| 0d 0a 0d 0a 1b 46 20 20 | 20 20 20 1b 45 43 48 41 |.....F | .ECHA|
|00001c90| 50 54 45 52 20 35 1b 46 | 20 20 20 20 20 20 20 20 |PTER 5.F| |
|00001ca0| 20 20 20 20 20 20 20 1b | 45 49 4e 54 45 52 41 43 | .|EINTERAC|
|00001cb0| 54 49 56 45 20 50 52 4f | 47 52 41 4d 4d 49 4e 47 |TIVE PRO|GRAMMING|
|00001cc0| 1b 46 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |.F | |
|00001cd0| 20 20 1b 45 43 48 41 50 | 54 45 52 20 35 0d 0a 0d | .ECHAP|TER 5...|
|00001ce0| 0a 0d 0a 20 20 20 20 20 | 45 52 52 55 52 20 43 48 |... |ERRUR CH|
|00001cf0| 45 43 4b 4c 49 4e 47 0d | 0a 0d 0a 20 20 20 20 20 |ECKLING.|... |
|00001d00| 1b 46 53 69 6e 63 65 20 | 65 76 65 72 79 62 6f 64 |.FSince |everybod|
|00001d10| 79 20 6d 61 6b 65 73 20 | 6d 69 73 74 61 6b 65 73 |y makes |mistakes|
|00001d20| 2c 20 74 68 65 72 65 20 | 69 73 20 6e 6f 20 72 65 |, there |is no re|
|00001d30| 61 73 6f 6e 20 6f 6e 20 | 47 6f 64 27 73 20 67 72 |ason on |God's gr|
|00001d40| 65 65 6e 20 65 61 72 74 | 68 0d 0a 20 20 20 20 20 |een eart|h.. |
|00001d50| 74 6f 20 61 73 73 75 6d | 65 20 74 68 61 74 20 79 |to assum|e that y|
|00001d60| 6f 75 72 20 70 72 6f 67 | 72 61 6d 20 77 69 6c 6c |our prog|ram will|
|00001d70| 20 61 6c 77 61 79 73 20 | 67 65 74 20 67 6f 6f 64 | always |get good|
|00001d80| 20 64 61 74 61 2e 20 20 | 49 66 20 74 68 65 20 69 | data. |If the i|
|00001d90| 6e 70 75 74 20 69 73 0d | 0a 20 20 20 20 20 6e 6f |nput is.|. no|
|00001da0| 74 20 72 65 61 73 6f 6e | 61 62 6c 65 2c 20 69 74 |t reason|able, it|
|00001db0| 20 77 69 6c 6c 20 63 61 | 75 73 65 20 70 72 6f 62 | will ca|use prob|
|00001dc0| 6c 65 6d 73 2e 20 20 49 | 6e 20 6f 75 72 20 63 61 |lems. I|n our ca|
|00001dd0| 73 65 2c 20 77 65 27 72 | 65 20 69 6e 74 65 72 65 |se, we'r|e intere|
|00001de0| 73 74 65 64 0d 0a 20 20 | 20 20 20 69 6e 20 63 68 |sted.. | in ch|
|00001df0| 65 63 6b 69 6e 67 20 74 | 68 65 20 72 65 70 6c 79 |ecking t|he reply|
|00001e00| 20 74 6f 20 73 75 63 68 | 20 71 75 65 73 74 69 6f | to such| questio|
|00001e10| 6e 73 20 61 73 20 22 64 | 6f 20 79 6f 75 20 77 61 |ns as "d|o you wa|
|00001e20| 6e 74 20 74 6f 20 67 6f | 20 69 6e 20 61 0d 0a 20 |nt to go| in a.. |
|00001e30| 20 20 20 20 63 69 72 63 | 6c 65 22 2e 20 20 57 65 | circ|le". We|
|00001e40| 20 73 68 6f 75 6c 64 20 | 6d 61 6b 65 20 73 75 72 | should |make sur|
|00001e50| 65 20 74 68 61 74 20 22 | 79 65 73 22 20 6f 72 20 |e that "|yes" or |
|00001e60| 22 6e 6f 22 20 61 72 65 | 20 74 68 65 20 6f 6e 6c |"no" are| the onl|
|00001e70| 79 20 61 63 63 65 70 74 | 61 62 6c 65 0d 0a 20 20 |y accept|able.. |
|00001e80| 20 20 20 61 6e 73 77 65 | 72 73 2e 20 20 54 68 69 | answe|rs. Thi|
|00001e90| 73 20 73 69 74 75 61 74 | 69 6f 6e 20 69 73 20 63 |s situat|ion is c|
|00001ea0| 6f 6d 70 6c 69 63 61 74 | 65 64 20 73 6f 6d 65 77 |omplicat|ed somew|
|00001eb0| 68 61 74 20 62 79 20 74 | 68 65 20 66 61 63 74 20 |hat by t|he fact |
|00001ec0| 74 68 61 74 20 74 68 65 | 20 50 43 0d 0a 20 20 20 |that the| PC.. |
|00001ed0| 20 20 69 73 20 63 61 73 | 65 20 73 65 6e 73 69 74 | is cas|e sensit|
|00001ee0| 69 76 65 2e 20 20 49 74 | 20 64 6f 65 73 20 6e 6f |ive. It| does no|
|00001ef0| 74 20 63 6f 6e 73 69 64 | 65 72 20 61 6e 20 75 70 |t consid|er an up|
|00001f00| 70 65 72 20 63 61 73 65 | 20 27 59 45 53 27 20 61 |per case| 'YES' a|
|00001f10| 6e 64 20 61 20 6c 6f 77 | 65 72 0d 0a 20 20 20 20 |nd a low|er.. |
|00001f20| 20 63 61 73 65 20 27 79 | 65 73 27 20 74 6f 20 62 | case 'y|es' to b|
|00001f30| 65 20 74 68 65 20 73 61 | 6d 65 20 74 68 69 6e 67 |e the sa|me thing|
|00001f40| 2e 20 20 4d 61 6b 65 73 | 20 73 65 6e 73 65 2c 20 |. Makes| sense, |
|00001f50| 74 65 63 68 6e 69 63 61 | 6c 6c 79 20 74 68 65 79 |technica|lly they|
|00001f60| 20 61 72 65 20 6e 6f 74 | 2e 0d 0a 0d 0a 20 20 20 | are not|..... |
|00001f70| 20 20 4f 6e 20 74 6f 70 | 20 6f 66 20 74 68 61 74 | On top| of that|
|00001f80| 2c 20 77 65 20 6b 6e 6f | 77 20 74 68 61 74 20 74 |, we kno|w that t|
|00001f90| 68 65 72 65 20 61 72 65 | 20 6e 6f 20 73 75 63 68 |here are| no such|
|00001fa0| 20 74 68 69 6e 67 73 20 | 61 73 20 63 69 72 63 6c | things |as circl|
|00001fb0| 65 73 20 77 69 74 68 20 | 61 0d 0a 20 20 20 20 20 |es with |a.. |
|00001fc0| 6e 65 67 61 74 69 76 65 | 20 72 61 64 69 75 73 20 |negative| radius |
|00001fd0| 6f 72 20 63 69 72 63 6c | 65 73 20 77 69 74 68 20 |or circl|es with |
|00001fe0| 61 20 72 61 64 69 75 73 | 20 6f 66 20 7a 65 72 6f |a radius| of zero|
|00001ff0| 2c 20 73 6f 20 77 65 20 | 6e 65 65 64 20 74 6f 20 |, so we |need to |
|00002000| 6d 61 6b 65 0d 0a 20 20 | 20 20 20 73 75 72 65 20 |make.. | sure |
|00002010| 74 68 61 74 20 6f 75 72 | 20 70 72 6f 67 72 61 6d |that our| program|
|00002020| 20 64 6f 65 73 20 6e 6f | 74 20 61 63 63 65 70 74 | does no|t accept|
|00002030| 20 69 6e 70 75 74 20 74 | 68 61 74 20 63 72 65 61 | input t|hat crea|
|00002040| 74 65 73 20 74 68 69 73 | 20 74 79 70 65 20 6f 66 |tes this| type of|
|00002050| 0d 0a 20 20 20 20 20 63 | 72 65 61 74 75 72 65 2e |.. c|reature.|
|00002060| 0d 0a 0d 0a 20 20 20 20 | 20 45 72 72 6f 72 20 63 |.... | Error c|
|00002070| 68 65 63 6b 69 6e 67 20 | 69 73 20 61 6e 6f 74 68 |hecking |is anoth|
|00002080| 65 72 20 6f 66 20 74 68 | 6f 73 65 20 65 61 73 79 |er of th|ose easy|
|00002090| 2c 20 61 6c 62 65 69 74 | 20 74 65 64 69 6f 75 73 |, albeit| tedious|
|000020a0| 2c 20 69 74 65 6d 73 2e | 20 20 54 68 69 73 0d 0a |, items.| This..|
|000020b0| 20 20 20 20 20 73 6f 75 | 6e 64 73 20 6c 69 6b 65 | sou|nds like|
|000020c0| 20 61 20 6a 6f 62 20 66 | 6f 72 20 57 48 49 4c 45 | a job f|or WHILE|
|000020d0| 6d 61 6e 21 21 21 21 21 | 2e 0d 0a 0d 0a 20 20 20 |man!!!!!|..... |
|000020e0| 20 20 4c 65 74 27 73 20 | 63 68 65 63 6b 20 74 68 | Let's |check th|
|000020f0| 65 20 69 6e 70 75 74 20 | 66 6f 72 20 61 20 72 61 |e input |for a ra|
|00002100| 64 69 75 73 3a 0d 0a 0d | 0a 20 20 20 20 20 33 32 |dius:...|. 32|
|00002110| 30 20 27 0d 0a 20 20 20 | 20 20 33 32 32 20 49 4e |0 '.. | 322 IN|
|00002120| 50 55 54 20 22 44 4f 20 | 59 4f 55 20 57 41 4e 54 |PUT "DO |YOU WANT|
|00002130| 20 54 4f 20 47 4f 20 49 | 4e 20 41 20 43 49 52 43 | TO GO I|N A CIRC|
|00002140| 4c 45 20 28 59 45 53 20 | 4f 52 20 4e 4f 29 22 3b |LE (YES |OR NO)";|
|00002150| 20 41 4e 53 24 0d 0a 20 | 20 20 20 20 33 32 34 20 | ANS$.. | 324 |
|00002160| 27 0d 0a 20 20 20 20 20 | 33 32 36 20 57 48 49 4c |'.. |326 WHIL|
|00002170| 45 20 41 4e 53 24 20 3d | 20 22 59 45 53 22 0d 0a |E ANS$ =| "YES"..|
|00002180| 20 20 20 20 20 33 32 38 | 20 27 0d 0a 20 20 20 20 | 328| '.. |
|00002190| 20 33 33 30 20 20 20 20 | 49 4e 50 55 54 20 22 57 | 330 |INPUT "W|
|000021a0| 48 41 54 20 49 53 20 54 | 48 45 20 52 41 44 49 55 |HAT IS T|HE RADIU|
|000021b0| 53 20 4f 46 20 59 4f 55 | 52 20 43 49 52 43 4c 45 |S OF YOU|R CIRCLE|
|000021c0| 22 3b 20 52 41 44 49 55 | 53 0d 0a 20 20 20 20 20 |"; RADIU|S.. |
|000021d0| 33 33 31 20 27 0d 0a 20 | 20 20 20 20 33 33 32 20 |331 '.. | 332 |
|000021e0| 20 20 20 57 48 49 4c 45 | 20 52 41 44 49 55 53 20 | WHILE| RADIUS |
|000021f0| 3c 3d 20 30 0d 0a 20 20 | 20 20 20 33 33 33 20 20 |<= 0.. | 333 |
|00002200| 20 20 20 20 20 50 52 49 | 4e 54 0d 0a 20 20 20 20 | PRI|NT.. |
|00002210| 20 33 33 34 20 20 20 20 | 20 20 20 49 4e 50 55 54 | 334 | INPUT|
|00002220| 20 22 54 48 41 54 20 4d | 55 53 54 20 42 45 20 41 | "THAT M|UST BE A|
|00002230| 20 4e 55 4d 42 45 52 20 | 3e 20 30 22 3b 52 41 44 | NUMBER |> 0";RAD|
|00002240| 49 55 53 0d 0a 20 20 20 | 20 20 33 33 35 20 20 20 |IUS.. | 335 |
|00002250| 20 20 20 20 50 52 49 4e | 54 0d 0a 20 20 20 20 20 | PRIN|T.. |
|00002260| 33 33 36 20 20 20 20 57 | 45 4e 44 0d 0a 20 20 20 |336 W|END.. |
|00002270| 20 20 33 33 38 20 27 0d | 0a 20 20 20 20 20 33 34 | 338 '.|. 34|
|00002280| 30 20 20 20 20 41 52 45 | 41 20 20 20 20 20 3d 20 |0 ARE|A = |
|00002290| 50 49 45 20 2a 20 52 41 | 44 49 55 53 20 2a 20 52 |PIE * RA|DIUS * R|
|000022a0| 41 44 49 55 53 0d 0a 20 | 20 20 20 20 33 35 30 20 |ADIUS.. | 350 |
|000022b0| 20 20 20 44 49 41 4d 45 | 54 45 52 20 3d 20 52 41 | DIAME|TER = RA|
|000022c0| 44 49 55 53 20 2a 20 32 | 0d 0a 20 20 20 20 20 33 |DIUS * 2|.. 3|
|000022d0| 35 35 20 27 0d 0a 20 20 | 20 20 20 33 36 30 20 20 |55 '.. | 360 |
|000022e0| 20 20 50 52 49 4e 54 0d | 0a 20 20 20 20 20 33 38 | PRINT.|. 38|
|000022f0| 30 20 20 20 20 50 52 49 | 4e 54 20 22 54 48 45 20 |0 PRI|NT "THE |
|00002300| 41 52 45 41 20 49 53 3a | 20 20 20 20 20 22 3b 41 |AREA IS:| ";A|
|00002310| 52 45 41 3b 22 20 53 51 | 55 41 52 45 20 49 4e 43 |REA;" SQ|UARE INC|
|00002320| 48 45 53 22 0d 0a 20 20 | 20 20 20 33 39 30 20 20 |HES".. | 390 |
|00002330| 20 20 50 52 49 4e 54 20 | 22 54 48 45 20 44 49 41 | PRINT |"THE DIA|
|00002340| 4d 45 54 45 52 20 49 53 | 3a 20 22 3b 44 49 41 4d |METER IS|: ";DIAM|
|00002350| 45 54 45 52 3b 22 20 49 | 4e 43 48 45 53 22 0d 0a |ETER;" I|NCHES"..|
|00002360| 20 20 20 20 20 34 30 30 | 20 20 20 20 50 52 49 4e | 400| PRIN|
|00002370| 54 0d 0a 20 20 20 20 20 | 34 30 32 20 27 0d 0a 20 |T.. |402 '.. |
|00002380| 20 20 20 20 34 30 34 20 | 20 20 20 49 4e 50 55 54 | 404 | INPUT|
|00002390| 20 22 44 4f 20 59 4f 55 | 20 57 41 4e 54 20 54 4f | "DO YOU| WANT TO|
|000023a0| 20 4d 41 4b 45 20 41 4e | 4f 54 48 45 52 20 43 49 | MAKE AN|OTHER CI|
|000023b0| 52 43 4c 45 22 3b 20 41 | 4e 53 24 0d 0a 20 20 20 |RCLE"; A|NS$.. |
|000023c0| 20 20 34 30 36 20 27 0d | 0a 20 20 20 20 20 34 30 | 406 '.|. 40|
|000023d0| 38 20 57 45 4e 44 0d 0a | 0d 0a 20 20 20 20 20 54 |8 WEND..|.. T|
|000023e0| 68 65 20 57 48 49 4c 45 | 20 6c 6f 6f 70 20 74 68 |he WHILE| loop th|
|000023f0| 61 74 20 70 72 6f 76 69 | 64 65 73 20 74 68 65 20 |at provi|des the |
|00002400| 65 72 72 6f 72 20 63 68 | 65 63 6b 69 6e 67 20 69 |error ch|ecking i|
|00002410| 73 20 6f 6e 20 6c 69 6e | 65 73 20 33 33 32 20 74 |s on lin|es 332 t|
|00002420| 68 72 6f 75 67 68 0d 0a | 20 20 20 20 20 33 33 36 |hrough..| 336|
|00002430| 2e 20 20 49 74 20 77 69 | 6c 6c 20 6b 65 65 70 20 |. It wi|ll keep |
|00002440| 72 65 71 75 65 73 74 69 | 6e 67 20 69 6e 70 75 74 |requesti|ng input|
|00002450| 20 75 6e 74 69 6c 20 69 | 74 20 72 65 63 65 69 76 | until i|t receiv|
|00002460| 65 73 20 61 20 70 6f 73 | 69 74 69 76 65 20 6e 75 |es a pos|itive nu|
|00002470| 6d 62 65 72 2e 0d 0a 20 | 20 20 20 20 4f 6e 63 65 |mber... | Once|
|00002480| 20 74 68 69 73 20 6f 63 | 63 75 72 73 2c 20 74 68 | this oc|curs, th|
|00002490| 65 20 70 72 6f 67 72 61 | 6d 20 6c 6f 67 69 63 20 |e progra|m logic |
|000024a0| 63 6f 6e 74 69 6e 75 65 | 73 2e 20 20 41 6c 6c 20 |continue|s. All |
|000024b0| 74 68 65 20 65 72 72 6f | 72 20 63 68 65 63 6b 73 |the erro|r checks|
|000024c0| 0d 0a 20 20 20 20 20 77 | 65 27 6c 6c 20 75 73 65 |.. w|e'll use|
|000024d0| 20 66 72 6f 6d 20 6e 6f | 77 20 6f 6e 20 65 6d 70 | from no|w on emp|
|000024e0| 6c 6f 79 20 74 68 65 20 | 73 61 6d 65 20 74 65 63 |loy the |same tec|
|000024f0| 68 6e 69 71 75 65 73 2e | 0d 0a 0d 0a 0d 0a 0d 0a |hniques.|........|
|00002500| 0d 0a 0d 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 |.... | |
|00002510| 20 20 20 20 20 1b 45 20 | 20 20 20 20 20 20 20 20 | .E | |
|00002520| 20 20 20 20 20 20 20 1b | 46 20 20 20 20 20 20 20 | .|F |
|00002530| 1b 45 20 20 35 32 0d 0a | 0d 0a 0c 0d 0a 0d 0a 0d |.E 52..|........|
|00002540| 0a 0d 0a 1b 46 20 20 20 | 20 20 1b 45 43 48 41 50 |....F | .ECHAP|
|00002550| 54 45 52 20 35 1b 46 20 | 20 20 20 20 20 20 20 20 |TER 5.F | |
|00002560| 20 20 20 20 20 20 1b 45 | 49 4e 54 45 52 41 43 54 | .E|INTERACT|
|00002570| 49 56 45 20 50 52 4f 47 | 52 41 4d 4d 49 4e 47 1b |IVE PROG|RAMMING.|
|00002580| 46 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |F | |
|00002590| 20 1b 45 43 48 41 50 54 | 45 52 20 35 0d 0a 0d 0a | .ECHAPT|ER 5....|
|000025a0| 0d 0a 20 20 20 20 20 1b | 46 45 72 72 6f 72 20 63 |.. .|FError c|
|000025b0| 68 65 63 6b 69 6e 67 20 | 61 20 73 74 72 69 6e 67 |hecking |a string|
|000025c0| 20 77 6f 72 6b 73 20 74 | 68 65 20 73 61 6d 65 20 | works t|he same |
|000025d0| 77 61 79 20 77 69 74 68 | 20 6f 6e 65 20 61 64 64 |way with| one add|
|000025e0| 65 64 20 63 6f 6d 70 6c | 69 63 61 74 69 6f 6e 2e |ed compl|ication.|
|000025f0| 0d 0a 20 20 20 20 20 53 | 69 6e 63 65 20 74 68 65 |.. S|ince the|
|00002600| 20 50 43 20 69 73 20 63 | 61 73 65 20 73 65 6e 73 | PC is c|ase sens|
|00002610| 69 74 69 76 65 20 79 6f | 75 20 68 61 76 65 20 74 |itive yo|u have t|
|00002620| 6f 20 63 68 65 63 6b 20 | 66 6f 72 20 62 6f 74 68 |o check |for both|
|00002630| 20 75 70 70 65 72 20 61 | 6e 64 0d 0a 20 20 20 20 | upper a|nd.. |
|00002640| 20 6c 6f 77 65 72 20 63 | 61 73 65 20 72 65 70 6c | lower c|ase repl|
|00002650| 69 65 73 2e 20 20 54 68 | 65 20 63 68 65 63 6b 20 |ies. Th|e check |
|00002660| 66 6f 72 20 61 20 79 65 | 73 20 6f 72 20 6e 6f 20 |for a ye|s or no |
|00002670| 61 6e 73 77 65 72 20 6c | 6f 6f 6b 73 20 6c 69 6b |answer l|ooks lik|
|00002680| 65 20 74 68 69 73 3a 0d | 0a 0d 0a 20 20 20 20 20 |e this:.|... |
|00002690| 49 4e 50 55 54 20 22 44 | 4f 20 59 4f 55 20 57 41 |INPUT "D|O YOU WA|
|000026a0| 4e 54 20 54 4f 20 47 4f | 20 49 4e 20 41 20 43 49 |NT TO GO| IN A CI|
|000026b0| 52 43 4c 45 20 28 59 45 | 53 20 4f 52 20 4e 4f 29 |RCLE (YE|S OR NO)|
|000026c0| 22 3b 20 41 4e 53 24 0d | 0a 20 20 20 20 20 27 0d |"; ANS$.|. '.|
|000026d0| 0a 20 20 20 20 20 57 48 | 49 4c 45 20 41 4e 53 24 |. WH|ILE ANS$|
|000026e0| 20 3c 3e 20 22 59 45 53 | 22 20 41 4e 44 20 41 4e | <> "YES|" AND AN|
|000026f0| 53 24 20 3c 3e 20 22 79 | 65 73 22 20 41 4e 44 20 |S$ <> "y|es" AND |
|00002700| 41 4e 53 24 20 3c 3e 20 | 22 4e 4f 22 20 41 4e 44 |ANS$ <> |"NO" AND|
|00002710| 20 41 4e 53 24 20 3c 3e | 20 22 6e 6f 22 0d 0a 20 | ANS$ <>| "no".. |
|00002720| 20 20 20 20 20 20 20 50 | 52 49 4e 54 0d 0a 20 20 | P|RINT.. |
|00002730| 20 20 20 20 20 20 49 4e | 50 55 54 20 22 54 48 41 | IN|PUT "THA|
|00002740| 54 27 53 20 41 20 27 59 | 45 53 27 20 4f 52 20 27 |T'S A 'Y|ES' OR '|
|00002750| 4e 4f 27 20 49 27 4d 20 | 4c 4f 4f 4b 49 4e 47 20 |NO' I'M |LOOKING |
|00002760| 46 4f 52 22 3b 20 41 4e | 53 24 0d 0a 20 20 20 20 |FOR"; AN|S$.. |
|00002770| 20 20 20 20 50 52 49 4e | 54 0d 0a 20 20 20 20 20 | PRIN|T.. |
|00002780| 57 45 4e 44 0d 0a 0d 0a | 20 20 20 20 20 59 6f 75 |WEND....| You|
|00002790| 20 6d 75 73 74 20 75 73 | 65 20 74 68 65 20 41 4e | must us|e the AN|
|000027a0| 44 20 62 65 63 61 75 73 | 65 20 79 6f 75 72 20 74 |D becaus|e your t|
|000027b0| 65 73 74 20 69 73 20 61 | 6e 20 69 6e 65 71 75 61 |est is a|n inequa|
|000027c0| 6c 69 74 79 2e 20 20 54 | 72 61 6e 73 6c 61 74 65 |lity. T|ranslate|
|000027d0| 64 2c 0d 0a 20 20 20 20 | 20 74 68 65 20 61 62 6f |d,.. | the abo|
|000027e0| 76 65 20 73 61 79 73 20 | 22 70 65 72 66 6f 72 6d |ve says |"perform|
|000027f0| 20 74 68 69 73 20 6c 6f | 6f 70 20 77 68 69 6c 65 | this lo|op while|
|00002800| 20 41 4e 53 24 20 69 73 | 20 6e 6f 74 20 79 65 73 | ANS$ is| not yes|
|00002810| 20 61 6e 64 20 6e 6f 22 | 2e 20 20 49 66 20 79 6f | and no"|. If yo|
|00002820| 75 0d 0a 20 20 20 20 20 | 75 73 65 64 20 61 6e 20 |u.. |used an |
|00002830| 4f 52 20 61 6e 64 20 3d | 20 73 69 67 6e 73 2c 20 |OR and =| signs, |
|00002840| 42 41 53 49 43 20 61 73 | 73 65 73 20 61 20 27 59 |BASIC as|ses a 'Y|
|00002850| 45 53 27 20 61 6e 73 77 | 65 72 20 69 6e 20 74 68 |ES' answ|er in th|
|00002860| 65 20 66 6f 6c 6c 6f 77 | 69 6e 67 20 77 61 79 3a |e follow|ing way:|
|00002870| 0d 0a 20 20 20 20 20 22 | 59 45 53 20 3d 20 27 59 |.. "|YES = 'Y|
|00002880| 45 53 27 20 62 75 74 20 | 69 74 27 73 20 3c 3e 20 |ES' but |it's <> |
|00002890| 27 79 65 73 27 20 6f 72 | 20 27 4e 4f 27 20 6f 72 |'yes' or| 'NO' or|
|000028a0| 20 27 6e 6f 27 20 73 6f | 20 69 74 20 6d 75 73 74 | 'no' so| it must|
|000028b0| 20 62 65 20 77 72 6f 6e | 67 22 2e 20 20 41 0d 0a | be wron|g". A..|
|000028c0| 20 20 20 20 20 62 69 74 | 20 77 65 69 72 64 20 62 | bit| weird b|
|000028d0| 75 74 20 74 68 61 74 27 | 73 20 77 68 61 74 20 68 |ut that'|s what h|
|000028e0| 61 70 70 65 6e 73 2e 20 | 20 54 68 65 72 65 20 61 |appens. | There a|
|000028f0| 72 65 20 6a 75 64 67 65 | 6d 65 6e 74 20 63 61 6c |re judge|ment cal|
|00002900| 6c 73 20 68 65 72 65 20 | 61 73 0d 0a 20 20 20 20 |ls here |as.. |
|00002910| 20 77 65 6c 6c 2e 20 20 | 57 65 20 64 6f 20 6e 6f | well. |We do no|
|00002920| 74 20 74 65 73 74 20 6f | 6e 20 22 59 65 73 22 2c |t test o|n "Yes",|
|00002930| 20 6f 72 20 22 79 45 73 | 22 2c 20 6f 72 20 22 59 | or "yEs|", or "Y|
|00002940| 45 73 22 20 65 74 63 2e | 2c 20 65 74 63 2e 2c 20 |Es" etc.|, etc., |
|00002950| 65 74 63 2e 2e 2e 2e 0d | 0a 0d 0a 20 20 20 20 20 |etc.....|... |
|00002960| 4d 4f 52 45 20 53 55 42 | 52 4f 55 54 49 4e 45 53 |MORE SUB|ROUTINES|
|00002970| 0d 0a 0d 0a 20 20 20 20 | 20 53 69 6e 63 65 20 77 |.... | Since w|
|00002980| 65 20 61 73 6b 20 66 6f | 72 20 61 20 79 65 73 2f |e ask fo|r a yes/|
|00002990| 6e 6f 20 61 6e 73 77 65 | 72 20 69 6e 20 74 77 6f |no answe|r in two|
|000029a0| 20 70 6c 61 63 65 73 20 | 28 6c 69 6e 65 73 20 33 | places |(lines 3|
|000029b0| 30 32 20 61 6e 64 20 34 | 30 34 29 2c 20 74 68 65 |02 and 4|04), the|
|000029c0| 0d 0a 20 20 20 20 20 65 | 72 72 6f 72 20 63 68 65 |.. e|rror che|
|000029d0| 63 6b 20 77 69 6c 6c 20 | 62 65 20 6e 65 65 64 65 |ck will |be neede|
|000029e0| 64 20 69 6e 20 74 68 65 | 20 73 61 6d 65 20 74 77 |d in the| same tw|
|000029f0| 6f 20 70 6c 61 63 65 73 | 2e 20 20 4c 65 74 27 73 |o places|. Let's|
|00002a00| 20 6e 6f 74 20 63 6f 64 | 65 20 69 74 0d 0a 20 20 | not cod|e it.. |
|00002a10| 20 20 20 74 77 69 63 65 | 21 1b 45 20 20 1b 46 57 | twice|!.E .FW|
|00002a20| 65 20 63 61 6e 20 73 61 | 76 65 20 6f 75 72 73 65 |e can sa|ve ourse|
|00002a30| 6c 76 65 73 20 73 6f 6d | 65 20 63 6f 64 65 20 62 |lves som|e code b|
|00002a40| 79 20 75 73 69 6e 67 20 | 61 20 73 75 62 72 6f 75 |y using |a subrou|
|00002a50| 74 69 6e 65 2e 0d 0a 0d | 0a 20 20 20 20 20 33 32 |tine....|. 32|
|00002a60| 32 20 49 4e 50 55 54 20 | 22 44 4f 20 59 4f 55 20 |2 INPUT |"DO YOU |
|00002a70| 57 41 4e 54 20 54 4f 20 | 47 4f 20 49 4e 20 41 20 |WANT TO |GO IN A |
|00002a80| 43 49 52 43 4c 45 20 28 | 59 45 53 20 4f 52 20 4e |CIRCLE (|YES OR N|
|00002a90| 4f 29 22 3b 20 41 4e 53 | 24 0d 0a 20 20 20 20 20 |O)"; ANS|$.. |
|00002aa0| 33 32 33 20 47 4f 53 55 | 42 20 36 30 30 20 20 20 |323 GOSU|B 600 |
|00002ab0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002ac0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002ad0| 20 20 20 20 20 20 20 27 | 59 45 53 20 4f 52 20 4e | '|YES OR N|
|00002ae0| 4f 20 43 48 45 43 4b 0d | 0a 20 20 20 20 20 33 32 |O CHECK.|. 32|
|00002af0| 34 20 27 0d 0a 20 20 20 | 20 20 33 32 36 20 57 48 |4 '.. | 326 WH|
|00002b00| 49 4c 45 20 41 4e 53 24 | 20 3d 20 22 59 45 53 22 |ILE ANS$| = "YES"|
|00002b10| 20 4f 52 20 41 4e 53 24 | 20 3d 20 22 79 65 73 22 | OR ANS$| = "yes"|
|00002b20| 0d 0a 20 20 20 20 20 33 | 32 38 20 27 0d 0a 20 20 |.. 3|28 '.. |
|00002b30| 20 20 20 33 33 30 20 20 | 20 20 49 4e 50 55 54 20 | 330 | INPUT |
|00002b40| 22 57 48 41 54 20 49 53 | 20 54 48 45 20 52 41 44 |"WHAT IS| THE RAD|
|00002b50| 49 55 53 20 4f 46 20 59 | 4f 55 52 20 43 49 52 43 |IUS OF Y|OUR CIRC|
|00002b60| 4c 45 22 3b 20 52 41 44 | 49 55 53 0d 0a 20 20 20 |LE"; RAD|IUS.. |
|00002b70| 20 20 33 33 31 20 27 0d | 0a 20 20 20 20 20 33 33 | 331 '.|. 33|
|00002b80| 32 20 20 20 20 57 48 49 | 4c 45 20 52 41 44 49 55 |2 WHI|LE RADIU|
|00002b90| 53 20 3c 3d 20 30 0d 0a | 20 20 20 20 20 33 33 33 |S <= 0..| 333|
|00002ba0| 20 20 20 20 20 20 20 50 | 52 49 4e 54 0d 0a 20 20 | P|RINT.. |
|00002bb0| 20 20 20 33 33 34 20 20 | 20 20 20 20 20 49 4e 50 | 334 | INP|
|00002bc0| 55 54 20 22 54 48 41 54 | 20 4d 55 53 54 20 42 45 |UT "THAT| MUST BE|
|00002bd0| 20 41 20 4e 55 4d 42 45 | 52 20 3e 20 30 22 3b 52 | A NUMBE|R > 0";R|
|00002be0| 41 44 49 55 53 0d 0a 20 | 20 20 20 20 33 33 35 20 |ADIUS.. | 335 |
|00002bf0| 20 20 20 20 20 20 50 52 | 49 4e 54 0d 0a 20 20 20 | PR|INT.. |
|00002c00| 20 20 33 33 36 20 20 20 | 20 57 45 4e 44 0d 0a 20 | 336 | WEND.. |
|00002c10| 20 20 20 20 33 33 38 20 | 27 0d 0a 20 20 20 20 20 | 338 |'.. |
|00002c20| 33 34 30 20 20 20 20 41 | 52 45 41 20 20 20 20 20 |340 A|REA |
|00002c30| 3d 20 50 49 45 20 2a 20 | 52 41 44 49 55 53 20 2a |= PIE * |RADIUS *|
|00002c40| 20 52 41 44 49 55 53 0d | 0a 20 20 20 20 20 33 35 | RADIUS.|. 35|
|00002c50| 30 20 20 20 20 44 49 41 | 4d 45 54 45 52 20 3d 20 |0 DIA|METER = |
|00002c60| 52 41 44 49 55 53 20 2a | 20 32 0d 0a 20 20 20 20 |RADIUS *| 2.. |
|00002c70| 20 33 35 35 20 27 0d 0a | 20 20 20 20 20 33 36 30 | 355 '..| 360|
|00002c80| 20 20 20 20 50 52 49 4e | 54 0d 0a 20 20 20 20 20 | PRIN|T.. |
|00002c90| 33 38 30 20 20 20 20 50 | 52 49 4e 54 20 22 54 48 |380 P|RINT "TH|
|00002ca0| 45 20 41 52 45 41 20 49 | 53 3a 20 20 20 20 20 22 |E AREA I|S: "|
|00002cb0| 3b 41 52 45 41 3b 22 20 | 53 51 55 41 52 45 20 49 |;AREA;" |SQUARE I|
|00002cc0| 4e 43 48 45 53 22 0d 0a | 20 20 20 20 20 33 39 30 |NCHES"..| 390|
|00002cd0| 20 20 20 20 50 52 49 4e | 54 20 22 54 48 45 20 44 | PRIN|T "THE D|
|00002ce0| 49 41 4d 45 54 45 52 20 | 49 53 3a 20 22 3b 44 49 |IAMETER |IS: ";DI|
|00002cf0| 41 4d 45 54 45 52 3b 22 | 20 49 4e 43 48 45 53 22 |AMETER;"| INCHES"|
|00002d00| 0d 0a 20 20 20 20 20 34 | 30 30 20 20 20 20 50 52 |.. 4|00 PR|
|00002d10| 49 4e 54 0d 0a 20 20 20 | 20 20 34 30 32 20 27 0d |INT.. | 402 '.|
|00002d20| 0a 20 20 20 20 20 34 30 | 34 20 20 20 20 49 4e 50 |. 40|4 INP|
|00002d30| 55 54 20 22 44 4f 20 59 | 4f 55 20 57 41 4e 54 20 |UT "DO Y|OU WANT |
|00002d40| 54 4f 20 4d 41 4b 45 20 | 41 4e 4f 54 48 45 52 20 |TO MAKE |ANOTHER |
|00002d50| 43 49 52 43 4c 45 22 3b | 20 41 4e 53 24 0d 0a 20 |CIRCLE";| ANS$.. |
|00002d60| 20 20 20 20 34 30 35 20 | 20 20 20 47 4f 53 55 42 | 405 | GOSUB|
|00002d70| 20 36 30 30 20 20 20 20 | 20 20 20 20 20 20 20 20 | 600 | |
|00002d80| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002d90| 20 20 20 20 20 20 20 20 | 20 20 20 27 59 45 53 20 | | 'YES |
|00002da0| 4f 52 20 4e 4f 20 43 48 | 45 43 4b 0d 0a 20 20 20 |OR NO CH|ECK.. |
|00002db0| 20 20 34 30 36 20 27 0d | 0a 20 20 20 20 20 34 30 | 406 '.|. 40|
|00002dc0| 38 20 57 45 4e 44 0d 0a | 0d 0a 20 20 20 20 20 4e |8 WEND..|.. N|
|00002dd0| 6f 74 65 20 74 68 61 74 | 20 74 68 65 20 57 48 49 |ote that| the WHI|
|00002de0| 4c 45 20 6f 6e 20 6c 69 | 6e 65 20 33 32 36 20 68 |LE on li|ne 326 h|
|00002df0| 61 73 20 62 65 65 6e 20 | 63 68 61 6e 67 65 64 20 |as been |changed |
|00002e00| 74 6f 20 63 68 65 63 6b | 20 66 6f 72 20 62 6f 74 |to check| for bot|
|00002e10| 68 20 75 70 70 65 72 0d | 0a 20 20 20 20 20 61 6e |h upper.|. an|
|00002e20| 64 20 6c 6f 77 65 72 20 | 63 61 73 65 2e 0d 0a 0d |d lower |case....|
|00002e30| 0a 0d 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |... | |
|00002e40| 20 20 20 20 1b 45 20 20 | 20 20 20 20 20 20 20 20 | .E | |
|00002e50| 20 20 20 20 20 20 1b 46 | 20 20 20 20 20 20 20 1b | .F| .|
|00002e60| 45 20 20 35 33 0d 0a 0d | 0a 0c 0d 0a 0d 0a 0d 0a |E 53...|........|
|00002e70| 0d 0a 1b 46 20 20 20 20 | 20 1b 45 43 48 41 50 54 |...F | .ECHAPT|
|00002e80| 45 52 20 35 1b 46 20 20 | 20 20 20 20 20 20 20 20 |ER 5.F | |
|00002e90| 20 20 20 20 20 1b 45 49 | 4e 54 45 52 41 43 54 49 | .EI|NTERACTI|
|00002ea0| 56 45 20 50 52 4f 47 52 | 41 4d 4d 49 4e 47 1b 46 |VE PROGR|AMMING.F|
|00002eb0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002ec0| 1b 45 43 48 41 50 54 45 | 52 20 35 0d 0a 0d 0a 0d |.ECHAPTE|R 5.....|
|00002ed0| 0a 20 20 20 20 20 1b 46 | 54 68 65 20 74 61 69 6c |. .F|The tail|
|00002ee0| 20 65 6e 64 20 6f 66 20 | 6f 75 72 20 70 72 6f 67 | end of |our prog|
|00002ef0| 72 61 6d 20 6c 6f 6f 6b | 73 20 6c 69 6b 65 20 74 |ram look|s like t|
|00002f00| 68 69 73 3a 0d 0a 0d 0a | 20 20 20 20 20 34 31 30 |his:....| 410|
|00002f10| 20 53 54 4f 50 0d 0a 20 | 20 20 20 20 36 30 30 20 | STOP.. | 600 |
|00002f20| 27 0d 0a 20 20 20 20 20 | 36 31 30 20 2a 2a 2a 2a |'.. |610 ****|
|00002f30| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 20 53 55 |********|***** SU|
|00002f40| 42 52 4f 55 54 49 4e 45 | 20 46 4f 52 20 59 45 53 |BROUTINE| FOR YES|
|00002f50| 2f 4e 4f 20 43 48 45 43 | 4b 20 2a 2a 2a 2a 2a 2a |/NO CHEC|K ******|
|00002f60| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 0d 0a 20 20 20 20 20 |********|*.. |
|00002f70| 36 32 30 20 27 0d 0a 20 | 20 20 20 20 36 33 30 20 |620 '.. | 630 |
|00002f80| 57 48 49 4c 45 20 41 4e | 53 24 20 3c 3e 22 59 45 |WHILE AN|S$ <>"YE|
|00002f90| 53 22 20 41 4e 44 20 41 | 4e 53 24 20 3c 3e 22 79 |S" AND A|NS$ <>"y|
|00002fa0| 65 73 22 20 41 4e 44 20 | 41 4e 53 24 20 3c 3e 22 |es" AND |ANS$ <>"|
|00002fb0| 4e 4f 22 20 41 4e 44 20 | 41 4e 53 24 20 3c 3e 22 |NO" AND |ANS$ <>"|
|00002fc0| 6e 6f 22 0d 0a 20 20 20 | 20 20 36 34 30 20 20 20 |no".. | 640 |
|00002fd0| 20 50 52 49 4e 54 0d 0a | 20 20 20 20 20 36 35 30 | PRINT..| 650|
|00002fe0| 20 20 20 20 49 4e 50 55 | 54 20 22 54 48 41 54 27 | INPU|T "THAT'|
|00002ff0| 53 20 41 20 27 59 45 53 | 27 20 4f 52 20 27 4e 4f |S A 'YES|' OR 'NO|
|00003000| 27 20 49 27 4d 20 4c 4f | 4f 4b 49 4e 47 20 46 4f |' I'M LO|OKING FO|
|00003010| 52 22 3b 20 41 4e 53 24 | 0d 0a 20 20 20 20 20 36 |R"; ANS$|.. 6|
|00003020| 36 30 20 20 20 20 50 52 | 49 4e 54 0d 0a 20 20 20 |60 PR|INT.. |
|00003030| 20 20 36 37 30 20 57 45 | 4e 44 0d 0a 20 20 20 20 | 670 WE|ND.. |
|00003040| 20 36 38 30 20 27 0d 0a | 20 20 20 20 20 36 39 30 | 680 '..| 690|
|00003050| 20 52 45 54 55 52 4e 0d | 0a 20 20 20 20 20 37 30 | RETURN.|. 70|
|00003060| 30 20 27 0d 0a 20 20 20 | 20 20 37 31 30 20 45 4e |0 '.. | 710 EN|
|00003070| 44 0d 0a 0d 0a 20 20 20 | 20 20 42 65 66 6f 72 65 |D.... | Before|
|00003080| 20 77 65 20 63 6f 6e 74 | 69 6e 75 65 2c 20 73 6f | we cont|inue, so|
|00003090| 6d 65 20 74 68 69 6e 67 | 73 20 6e 65 65 64 20 65 |me thing|s need e|
|000030a0| 6d 70 68 61 73 69 73 20 | 28 6f 72 20 72 65 2d 65 |mphasis |(or re-e|
|000030b0| 6d 70 68 61 73 69 73 29 | 3a 0d 0a 0d 0a 20 20 20 |mphasis)|:.... |
|000030c0| 20 20 2d 20 54 68 65 20 | 57 48 49 4c 45 20 6c 6f | - The |WHILE lo|
|000030d0| 6f 70 73 20 61 72 65 20 | 6e 65 73 74 65 64 2e 20 |ops are |nested. |
|000030e0| 20 54 68 69 73 20 69 73 | 20 6c 65 67 61 6c 20 68 | This is| legal h|
|000030f0| 6f 77 65 76 65 72 20 79 | 6f 75 20 6e 65 65 64 20 |owever y|ou need |
|00003100| 61 20 57 45 4e 44 0d 0a | 20 20 20 20 20 20 20 73 |a WEND..| s|
|00003110| 74 61 74 65 6d 65 6e 74 | 20 66 6f 72 20 65 61 63 |tatement| for eac|
|00003120| 68 20 6c 6f 6f 70 20 28 | 6c 6f 6f 70 20 74 68 65 |h loop (|loop the|
|00003130| 20 6c 6f 6f 70 20 73 6f | 20 74 6f 20 73 70 65 61 | loop so| to spea|
|00003140| 6b 29 2e 0d 0a 20 20 20 | 20 20 2d 20 49 66 20 61 |k)... | - If a|
|00003150| 20 63 6f 72 72 65 63 74 | 20 69 6e 70 75 74 20 69 | correct| input i|
|00003160| 73 20 67 69 76 65 6e 20 | 61 6e 20 65 72 72 6f 72 |s given |an error|
|00003170| 20 6c 6f 6f 70 20 77 69 | 6c 6c 20 6e 65 76 65 72 | loop wi|ll never|
|00003180| 20 62 65 20 61 63 74 69 | 76 61 74 65 64 2e 0d 0a | be acti|vated...|
|00003190| 20 20 20 20 20 2d 20 45 | 76 65 72 79 20 74 69 6d | - E|very tim|
|000031a0| 65 20 77 65 20 73 74 61 | 72 74 20 61 20 6e 65 77 |e we sta|rt a new|
|000031b0| 20 6c 6f 6f 70 20 77 65 | 20 61 6c 73 6f 20 73 74 | loop we| also st|
|000031c0| 61 72 74 20 61 20 6e 65 | 77 20 6f 66 66 73 65 74 |art a ne|w offset|
|000031d0| 2e 0d 0a 20 20 20 20 20 | 2d 20 42 79 20 63 6f 6e |... |- By con|
|000031e0| 74 72 6f 6c 6c 69 6e 67 | 20 74 68 65 20 69 6e 70 |trolling| the inp|
|000031f0| 75 74 2c 20 79 6f 75 20 | 65 6e 73 75 72 65 20 74 |ut, you |ensure t|
|00003200| 68 61 74 20 74 68 65 20 | 70 72 6f 67 72 61 6d 20 |hat the |program |
|00003210| 77 6f 72 6b 73 20 70 72 | 6f 70 65 72 6c 79 0d 0a |works pr|operly..|
|00003220| 20 20 20 20 20 1b 45 20 | 20 1b 46 61 6e 64 20 70 | .E | .Fand p|
|00003230| 72 65 76 65 6e 74 20 74 | 68 65 20 75 73 65 72 20 |revent t|he user |
|00003240| 66 72 6f 6d 20 67 65 74 | 74 69 6e 67 20 66 72 75 |from get|ting fru|
|00003250| 73 74 72 61 74 65 64 20 | 28 77 69 74 68 20 74 68 |strated |(with th|
|00003260| 65 20 70 72 6f 67 72 61 | 6d 20 74 68 61 74 0d 0a |e progra|m that..|
|00003270| 20 20 20 20 20 20 1b 45 | 20 1b 46 69 73 29 2e 0d | .E| .Fis)..|
|00003280| 0a 20 20 20 20 20 2d 20 | 45 72 72 6f 72 20 6d 65 |. - |Error me|
|00003290| 73 73 61 67 65 73 20 6d | 75 73 74 20 61 6c 77 61 |ssages m|ust alwa|
|000032a0| 79 73 20 67 69 76 65 20 | 61 20 67 6f 6f 64 20 69 |ys give |a good i|
|000032b0| 6e 64 69 63 61 74 69 6f | 6e 20 6f 66 20 77 68 61 |ndicatio|n of wha|
|000032c0| 74 20 74 68 65 20 70 72 | 6f 62 6c 65 6d 0d 0a 20 |t the pr|oblem.. |
|000032d0| 20 20 20 20 1b 45 20 20 | 1b 46 69 73 20 61 6e 64 | .E |.Fis and|
|000032e0| 20 68 6f 77 20 74 6f 20 | 73 6f 6c 76 65 20 69 74 | how to |solve it|
|000032f0| 2e 20 20 4d 61 6b 65 20 | 74 68 65 6d 20 61 73 20 |. Make |them as |
|00003300| 6d 65 61 6e 69 6e 67 66 | 75 6c 20 61 73 20 70 6f |meaningf|ul as po|
|00003310| 73 73 69 62 6c 65 20 61 | 6e 64 20 75 73 65 0d 0a |ssible a|nd use..|
|00003320| 20 20 20 20 20 20 20 45 | 6e 67 6c 69 73 68 2c 20 | E|nglish, |
|00003330| 6e 6f 74 20 63 6f 6d 70 | 75 74 65 72 65 73 65 2e |not comp|uterese.|
|00003340| 0d 0a 0d 0a 0d 0a 20 20 | 20 20 20 1b 45 43 4c 45 |...... | .ECLE|
|00003350| 41 4e 55 50 0d 0a 0d 0a | 20 20 20 20 20 1b 46 57 |ANUP....| .FW|
|00003360| 65 20 73 74 69 6c 6c 20 | 6e 65 65 64 20 74 6f 20 |e still |need to |
|00003370| 63 6c 65 61 6e 20 75 70 | 20 6f 75 72 20 73 63 72 |clean up| our scr|
|00003380| 65 65 6e 20 6f 75 74 70 | 75 74 20 61 20 6c 69 74 |een outp|ut a lit|
|00003390| 74 6c 65 20 62 69 74 2e | 20 20 54 68 65 20 66 69 |tle bit.| The fi|
|000033a0| 72 73 74 0d 0a 20 20 20 | 20 20 63 6f 6d 6d 61 6e |rst.. | comman|
|000033b0| 64 20 77 65 20 6e 65 65 | 64 20 69 73 20 43 4c 53 |d we nee|d is CLS|
|000033c0| 2e 20 20 54 68 61 74 27 | 73 20 72 69 67 68 74 2c |. That'|s right,|
|000033d0| 20 43 4c 53 20 61 6e 64 | 20 6e 6f 74 68 69 6e 67 | CLS and| nothing|
|000033e0| 20 6d 6f 72 65 2e 20 20 | 49 74 20 6d 65 61 6e 73 | more. |It means|
|000033f0| 0d 0a 20 20 20 20 20 22 | 63 6c 65 61 72 20 74 68 |.. "|clear th|
|00003400| 65 20 73 63 72 65 65 6e | 20 61 6e 64 20 70 6f 73 |e screen| and pos|
|00003410| 69 74 69 6f 6e 20 74 68 | 65 20 63 75 72 73 6f 72 |ition th|e cursor|
|00003420| 20 61 74 20 74 68 65 20 | 74 6f 70 20 6c 65 66 74 | at the |top left|
|00003430| 20 63 6f 72 6e 65 72 22 | 2e 0d 0a 0d 0a 20 20 20 | corner"|..... |
|00003440| 20 20 4f 75 72 20 6e 65 | 78 74 20 63 6f 6d 6d 61 | Our ne|xt comma|
|00003450| 6e 64 20 69 73 20 4c 4f | 43 41 54 45 2c 20 61 6e |nd is LO|CATE, an|
|00003460| 20 69 6e 73 74 72 75 63 | 74 69 6f 6e 20 74 68 61 | instruc|tion tha|
|00003470| 74 20 70 6f 73 69 74 69 | 6f 6e 73 20 74 68 65 20 |t positi|ons the |
|00003480| 63 75 72 73 6f 72 0d 0a | 20 20 20 20 20 61 6e 79 |cursor..| any|
|00003490| 77 68 65 72 65 20 6f 6e | 20 74 68 65 20 73 63 72 |where on| the scr|
|000034a0| 65 65 6e 2e 20 20 54 6f | 20 64 6f 20 74 68 69 73 |een. To| do this|
|000034b0| 2c 20 42 41 53 49 43 20 | 6e 65 65 64 73 20 74 68 |, BASIC |needs th|
|000034c0| 65 20 6c 6f 63 61 74 69 | 6f 6e 20 61 74 20 77 68 |e locati|on at wh|
|000034d0| 69 63 68 0d 0a 20 20 20 | 20 20 79 6f 75 20 77 61 |ich.. | you wa|
|000034e0| 6e 74 20 74 68 65 20 63 | 75 72 73 6f 72 20 74 6f |nt the c|ursor to|
|000034f0| 20 61 70 70 65 61 72 2e | 20 20 54 68 65 20 63 6f | appear.| The co|
|00003500| 6d 6d 61 6e 64 20 73 79 | 6e 74 61 78 20 69 73 3a |mmand sy|ntax is:|
|00003510| 0d 0a 0d 0a 20 20 20 20 | 20 4c 4f 43 41 54 45 20 |.... | LOCATE |
|00003520| 58 2c 59 20 77 68 65 72 | 65 20 58 20 69 73 20 74 |X,Y wher|e X is t|
|00003530| 68 65 20 72 6f 77 20 28 | 31 20 74 6f 20 32 35 29 |he row (|1 to 25)|
|00003540| 20 61 6e 64 20 59 20 69 | 73 20 74 68 65 20 63 6f | and Y i|s the co|
|00003550| 6c 75 6d 6e 20 28 31 20 | 74 6f 20 38 30 29 0d 0a |lumn (1 |to 80)..|
|00003560| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003570| 74 68 61 74 20 79 6f 75 | 20 77 61 6e 74 20 74 6f |that you| want to|
|00003580| 20 73 74 61 72 74 20 69 | 6e 2e 0d 0a 0d 0a 20 20 | start i|n..... |
|00003590| 20 20 20 57 65 27 76 65 | 20 62 65 65 6e 20 75 73 | We've| been us|
|000035a0| 69 6e 67 20 50 52 49 4e | 54 20 74 6f 20 70 75 74 |ing PRIN|T to put|
|000035b0| 20 69 6e 20 62 6c 61 6e | 6b 20 6c 69 6e 65 73 2e | in blan|k lines.|
|000035c0| 20 20 57 68 65 6e 20 79 | 6f 75 20 77 6f 72 6b 20 | When y|ou work |
|000035d0| 77 69 74 68 20 74 68 65 | 0d 0a 20 20 20 20 20 73 |with the|.. s|
|000035e0| 63 72 65 65 6e 20 61 6e | 64 20 74 68 65 20 4c 4f |creen an|d the LO|
|000035f0| 43 41 54 45 20 63 6f 6d | 6d 61 6e 64 2c 20 79 6f |CATE com|mand, yo|
|00003600| 75 20 64 6f 6e 27 74 20 | 6e 65 65 64 20 74 6f 20 |u don't |need to |
|00003610| 75 73 65 20 50 52 49 4e | 54 20 66 6f 72 20 74 68 |use PRIN|T for th|
|00003620| 69 73 0d 0a 20 20 20 20 | 20 66 75 6e 63 74 69 6f |is.. | functio|
|00003630| 6e 2e 20 20 43 4c 53 20 | 77 69 6c 6c 20 63 6c 65 |n. CLS |will cle|
|00003640| 61 72 20 74 68 65 20 73 | 63 72 65 65 6e 2c 20 61 |ar the s|creen, a|
|00003650| 6e 64 20 4c 4f 43 41 54 | 45 20 77 69 6c 6c 20 70 |nd LOCAT|E will p|
|00003660| 75 74 20 79 6f 75 72 20 | 63 75 72 73 6f 72 0d 0a |ut your |cursor..|
|00003670| 20 20 20 20 20 61 6e 79 | 77 68 65 72 65 20 28 6f | any|where (o|
|00003680| 6e 20 74 68 65 20 73 63 | 72 65 65 6e 20 74 68 61 |n the sc|reen tha|
|00003690| 74 20 69 73 29 2e 0d 0a | 0d 0a 20 20 20 20 20 53 |t is)...|.. S|
|000036a0| 69 6e 63 65 20 6f 6e 65 | 20 70 72 6f 67 72 61 6d |ince one| program|
|000036b0| 20 69 73 20 77 6f 72 74 | 68 20 61 20 74 68 6f 75 | is wort|h a thou|
|000036c0| 73 61 6e 64 20 77 6f 72 | 64 73 2c 20 74 68 65 20 |sand wor|ds, the |
|000036d0| 73 6f 75 72 63 65 20 6c | 69 73 74 69 6e 67 20 6f |source l|isting o|
|000036e0| 6e 20 74 68 65 0d 0a 20 | 20 20 20 20 6e 65 78 74 |n the.. | next|
|000036f0| 20 70 61 67 65 20 73 68 | 6f 77 73 20 79 6f 75 20 | page sh|ows you |
|00003700| 68 6f 77 20 61 6c 6c 20 | 74 68 69 73 20 66 69 74 |how all |this fit|
|00003710| 73 20 74 6f 67 65 74 68 | 65 72 2e 20 20 49 74 27 |s togeth|er. It'|
|00003720| 73 20 62 65 65 6e 20 72 | 65 6e 75 6d 62 65 72 65 |s been r|enumbere|
|00003730| 64 0d 0a 20 20 20 20 20 | 62 65 63 61 75 73 65 20 |d.. |because |
|00003740| 74 68 65 20 6c 6f 67 69 | 63 20 77 61 73 20 67 65 |the logi|c was ge|
|00003750| 74 74 69 6e 67 20 61 20 | 6c 69 74 74 6c 65 20 63 |tting a |little c|
|00003760| 72 6f 77 64 65 64 2e 20 | 20 53 69 67 6e 20 6f 6e |rowded. | Sign on|
|00003770| 20 79 6f 75 72 20 50 43 | 2c 20 65 6e 74 65 72 0d | your PC|, enter.|
|00003780| 0a 20 20 20 20 20 74 68 | 65 20 63 6f 64 65 2c 20 |. th|e code, |
|00003790| 61 6e 64 20 61 73 20 75 | 73 75 61 6c 20 70 6c 61 |and as u|sual pla|
|000037a0| 79 20 77 69 74 68 20 69 | 74 20 61 20 6c 69 74 74 |y with i|t a litt|
|000037b0| 6c 65 20 62 69 74 20 62 | 79 20 63 68 61 6e 67 69 |le bit b|y changi|
|000037c0| 6e 67 20 74 68 65 20 6e | 75 6d 62 65 72 73 0d 0a |ng the n|umbers..|
|000037d0| 20 20 20 20 20 62 65 68 | 69 6e 64 20 74 68 65 20 | beh|ind the |
|000037e0| 4c 4f 43 41 54 45 20 69 | 6e 73 74 72 75 63 74 69 |LOCATE i|nstructi|
|000037f0| 6f 6e 73 20 74 6f 20 73 | 65 65 20 77 68 61 74 20 |ons to s|ee what |
|00003800| 65 66 66 65 63 74 20 74 | 68 69 73 20 68 61 73 2e |effect t|his has.|
|00003810| 0d 0a 0d 0a 0d 0a 20 20 | 20 20 20 20 20 20 20 20 |...... | |
|00003820| 20 20 20 20 20 20 20 1b | 45 20 20 20 20 20 20 20 | .|E |
|00003830| 20 20 20 20 20 20 20 20 | 20 1b 46 20 20 20 20 20 | | .F |
|00003840| 20 20 1b 45 20 20 35 34 | 0d 0a 0d 0a 0c 0d 0a 0d | .E 54|........|
|00003850| 0a 0d 0a 0d 0a 1b 46 20 | 20 20 20 20 1b 45 43 48 |......F | .ECH|
|00003860| 41 50 54 45 52 20 35 1b | 46 20 20 20 20 20 20 20 |APTER 5.|F |
|00003870| 20 20 20 20 20 20 20 20 | 1b 45 49 4e 54 45 52 41 | |.EINTERA|
|00003880| 43 54 49 56 45 20 50 52 | 4f 47 52 41 4d 4d 49 4e |CTIVE PR|OGRAMMIN|
|00003890| 47 1b 46 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |G.F | |
|000038a0| 20 20 20 1b 45 43 48 41 | 50 54 45 52 20 35 0d 0a | .ECHA|PTER 5..|
|000038b0| 0d 0a 0d 0a 20 20 20 20 | 20 1b 46 31 30 30 20 27 |.... | .F100 '|
|000038c0| 20 20 20 20 4e 41 4d 45 | 3a 20 20 20 20 20 20 20 | NAME|: |
|000038d0| 20 20 20 20 43 49 52 43 | 4c 45 0d 0a 20 20 20 20 | CIRC|LE.. |
|000038e0| 20 31 31 30 20 27 20 20 | 20 20 57 52 49 54 54 45 | 110 ' | WRITTE|
|000038f0| 4e 20 42 59 3a 20 20 20 | 20 20 54 2e 20 41 55 54 |N BY: | T. AUT|
|00003900| 48 4f 52 0d 0a 20 20 20 | 20 20 31 32 30 20 27 20 |HOR.. | 120 ' |
|00003910| 20 20 20 44 41 54 45 20 | 57 52 49 54 54 45 4e 3a | DATE |WRITTEN:|
|00003920| 20 20 20 30 31 2f 30 31 | 2f 38 35 0d 0a 20 20 20 | 01/01|/85.. |
|00003930| 20 20 31 33 30 20 27 0d | 0a 20 20 20 20 20 31 34 | 130 '.|. 14|
|00003940| 30 20 27 20 20 20 20 54 | 48 49 53 20 49 53 20 41 |0 ' T|HIS IS A|
|00003950| 20 43 4f 4e 56 45 52 53 | 41 54 49 4f 4e 41 4c 20 | CONVERS|ATIONAL |
|00003960| 50 52 4f 47 52 41 4d 20 | 54 48 41 54 20 43 41 4c |PROGRAM |THAT CAL|
|00003970| 43 55 4c 41 54 45 53 20 | 54 48 45 20 41 52 45 41 |CULATES |THE AREA|
|00003980| 20 41 4e 44 0d 0a 20 20 | 20 20 20 31 35 30 20 27 | AND.. | 150 '|
|00003990| 20 20 20 20 44 49 41 4d | 45 54 45 52 20 4f 46 20 | DIAM|ETER OF |
|000039a0| 41 20 43 49 52 43 4c 45 | 20 47 49 56 45 4e 20 54 |A CIRCLE| GIVEN T|
|000039b0| 48 45 20 52 41 44 49 55 | 53 2e 0d 0a 20 20 20 20 |HE RADIU|S... |
|000039c0| 20 31 36 30 20 27 0d 0a | 20 20 20 20 20 31 37 30 | 160 '..| 170|
|000039d0| 20 27 20 20 20 20 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a | ' **|********|
|000039e0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 20 20 49 4e 50 |********|*** INP|
|000039f0| 55 54 20 56 41 52 49 41 | 42 4c 45 53 20 20 2a 2a |UT VARIA|BLES **|
|00003a00| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00003a10| 2a 2a 2a 0d 0a 20 20 20 | 20 20 31 38 30 20 27 0d |***.. | 180 '.|
|00003a20| 0a 20 20 20 20 20 31 39 | 30 20 27 20 20 20 20 52 |. 19|0 ' R|
|00003a30| 41 44 49 55 53 20 2e 2e | 2e 2e 2e 2e 2e 20 20 54 |ADIUS ..|..... T|
|00003a40| 48 45 20 52 41 44 49 55 | 53 20 4f 46 20 54 48 45 |HE RADIU|S OF THE|
|00003a50| 20 43 49 52 43 4c 45 0d | 0a 20 20 20 20 20 32 30 | CIRCLE.|. 20|
|00003a60| 30 20 27 0d 0a 20 20 20 | 20 20 32 31 30 20 27 20 |0 '.. | 210 ' |
|00003a70| 20 20 20 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a | *****|********|
|00003a80| 2a 2a 2a 2a 2a 2a 2a 2a | 20 20 4f 54 48 45 52 20 |********| OTHER |
|00003a90| 43 4f 4e 53 54 41 4e 54 | 53 20 20 2a 2a 2a 2a 2a |CONSTANT|S *****|
|00003aa0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00003ab0| 0d 0a 20 20 20 20 20 32 | 32 30 20 27 0d 0a 20 20 |.. 2|20 '.. |
|00003ac0| 20 20 20 32 33 30 20 27 | 20 20 20 20 50 49 45 20 | 230 '| PIE |
|00003ad0| 2e 2e 2e 2e 2e 2e 2e 2e | 2e 2e 20 20 4d 41 54 48 |........|.. MATH|
|00003ae0| 45 4d 41 54 49 43 41 4c | 20 56 41 4c 55 45 20 46 |EMATICAL| VALUE F|
|00003af0| 4f 52 20 50 49 0d 0a 20 | 20 20 20 20 32 34 30 20 |OR PI.. | 240 |
|00003b00| 27 20 20 20 20 41 52 45 | 41 20 2e 2e 2e 2e 2e 2e |' ARE|A ......|
|00003b10| 2e 2e 2e 20 20 54 48 45 | 20 41 52 45 41 20 4f 46 |... THE| AREA OF|
|00003b20| 20 54 48 45 20 43 49 52 | 43 4c 45 20 28 43 41 4c | THE CIR|CLE (CAL|
|00003b30| 43 55 4c 41 54 45 44 29 | 0d 0a 20 20 20 20 20 32 |CULATED)|.. 2|
|00003b40| 35 30 20 27 20 20 20 20 | 44 49 41 4d 45 54 45 52 |50 ' |DIAMETER|
|00003b50| 20 2e 2e 2e 2e 2e 20 20 | 54 48 45 20 44 49 41 4d | ..... |THE DIAM|
|00003b60| 45 54 45 52 20 4f 52 20 | 54 48 45 20 43 49 52 43 |ETER OR |THE CIRC|
|00003b70| 4c 45 20 28 43 41 4c 43 | 55 4c 41 54 45 44 29 0d |LE (CALC|ULATED).|
|00003b80| 0a 20 20 20 20 20 32 36 | 30 20 27 0d 0a 20 20 20 |. 26|0 '.. |
|00003b90| 20 20 32 37 30 20 27 20 | 20 20 20 2a 2a 2a 2a 2a | 270 ' | *****|
|00003ba0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00003bb0| 2a 20 20 49 4e 49 54 49 | 41 4c 49 5a 41 54 49 4f |* INITI|ALIZATIO|
|00003bc0| 4e 20 20 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |N *****|********|
|00003bd0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 0d 0a 20 20 20 20 20 |********|*.. |
|00003be0| 32 38 30 20 27 0d 0a 20 | 20 20 20 20 32 39 30 20 |280 '.. | 290 |
|00003bf0| 50 49 45 20 3d 20 33 2e | 31 34 31 35 39 0d 0a 20 |PIE = 3.|14159.. |
|00003c00| 20 20 20 20 33 30 30 20 | 27 0d 0a 20 20 20 20 20 | 300 |'.. |
|00003c10| 33 31 30 20 27 20 20 20 | 20 2a 2a 2a 2a 2a 2a 2a |310 ' | *******|
|00003c20| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 20 |********|******* |
|00003c30| 20 20 20 50 52 4f 43 45 | 53 53 49 4e 47 20 20 20 | PROCE|SSING |
|00003c40| 20 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a | *******|********|
|00003c50| 2a 2a 2a 2a 2a 2a 2a 0d | 0a 20 20 20 20 20 33 32 |*******.|. 32|
|00003c60| 30 20 27 0d 0a 20 20 20 | 20 20 33 33 30 20 43 4c |0 '.. | 330 CL|
|00003c70| 53 0d 0a 20 20 20 20 20 | 33 34 30 20 4c 4f 43 41 |S.. |340 LOCA|
|00003c80| 54 45 20 31 30 2c 31 35 | 0d 0a 20 20 20 20 20 33 |TE 10,15|.. 3|
|00003c90| 35 30 20 49 4e 50 55 54 | 20 22 44 4f 20 59 4f 55 |50 INPUT| "DO YOU|
|00003ca0| 20 57 41 4e 54 20 54 4f | 20 47 4f 20 49 4e 20 41 | WANT TO| GO IN A|
|00003cb0| 20 43 49 52 43 4c 45 20 | 28 59 45 53 20 4f 52 20 | CIRCLE |(YES OR |
|00003cc0| 4e 4f 29 22 3b 20 41 4e | 53 24 0d 0a 20 20 20 20 |NO)"; AN|S$.. |
|00003cd0| 20 33 36 30 20 27 0d 0a | 20 20 20 20 20 33 37 30 | 360 '..| 370|
|00003ce0| 20 47 4f 53 55 42 20 37 | 30 30 20 20 20 20 20 20 | GOSUB 7|00 |
|00003cf0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003d00| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003d10| 20 20 20 20 27 59 45 53 | 20 4f 52 20 4e 4f 20 43 | 'YES| OR NO C|
|00003d20| 48 45 43 4b 0d 0a 20 20 | 20 20 20 33 38 30 20 27 |HECK.. | 380 '|
|00003d30| 0d 0a 20 20 20 20 20 33 | 39 30 20 57 48 49 4c 45 |.. 3|90 WHILE|
|00003d40| 20 41 4e 53 24 20 3d 20 | 22 59 45 53 22 20 4f 52 | ANS$ = |"YES" OR|
|00003d50| 20 41 4e 53 24 20 3d 20 | 22 79 65 73 22 0d 0a 20 | ANS$ = |"yes".. |
|00003d60| 20 20 20 20 34 30 30 20 | 27 0d 0a 20 20 20 20 20 | 400 |'.. |
|00003d70| 34 31 30 20 20 20 20 43 | 4c 53 0d 0a 20 20 20 20 |410 C|LS.. |
|00003d80| 20 34 32 30 20 20 20 20 | 4c 4f 43 41 54 45 20 31 | 420 |LOCATE 1|
|00003d90| 30 2c 32 30 0d 0a 20 20 | 20 20 20 34 33 30 20 20 |0,20.. | 430 |
|00003da0| 20 20 49 4e 50 55 54 20 | 22 57 48 41 54 20 49 53 | INPUT |"WHAT IS|
|00003db0| 20 54 48 45 20 52 41 44 | 49 55 53 20 4f 46 20 59 | THE RAD|IUS OF Y|
|00003dc0| 4f 55 52 20 43 49 52 43 | 4c 45 22 3b 20 52 41 44 |OUR CIRC|LE"; RAD|
|00003dd0| 49 55 53 0d 0a 20 20 20 | 20 20 34 34 30 20 27 0d |IUS.. | 440 '.|
|00003de0| 0a 20 20 20 20 20 34 35 | 30 20 20 20 20 57 48 49 |. 45|0 WHI|
|00003df0| 4c 45 20 52 41 44 49 55 | 53 20 3c 3d 20 30 0d 0a |LE RADIU|S <= 0..|
|00003e00| 20 20 20 20 20 34 36 30 | 20 20 20 20 20 20 20 4c | 460| L|
|00003e10| 4f 43 41 54 45 20 32 33 | 2c 32 30 0d 0a 20 20 20 |OCATE 23|,20.. |
|00003e20| 20 20 34 37 30 20 20 20 | 20 20 20 20 50 52 49 4e | 470 | PRIN|
|00003e30| 54 20 22 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |T " | |
|00003e40| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003e50| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 22 20 27 | | " '|
|00003e60| 43 4c 45 41 52 20 4c 49 | 4e 45 0d 0a 20 20 20 20 |CLEAR LI|NE.. |
|00003e70| 20 34 38 30 20 20 20 20 | 20 20 20 4c 4f 43 41 54 | 480 | LOCAT|
|00003e80| 45 20 32 33 2c 32 30 0d | 0a 20 20 20 20 20 34 39 |E 23,20.|. 49|
|00003e90| 30 20 20 20 20 20 20 20 | 49 4e 50 55 54 20 22 54 |0 |INPUT "T|
|00003ea0| 48 41 54 20 4d 55 53 54 | 20 42 45 20 41 20 4e 55 |HAT MUST| BE A NU|
|00003eb0| 4d 42 45 52 20 3e 20 30 | 22 3b 52 41 44 49 55 53 |MBER > 0|";RADIUS|
|00003ec0| 0d 0a 20 20 20 20 20 35 | 30 30 20 20 20 20 57 45 |.. 5|00 WE|
|00003ed0| 4e 44 0d 0a 20 20 20 20 | 20 35 31 30 20 27 0d 0a |ND.. | 510 '..|
|00003ee0| 20 20 20 20 20 35 32 30 | 20 20 20 20 41 52 45 41 | 520| AREA|
|00003ef0| 20 20 20 20 20 3d 20 50 | 49 45 20 2a 20 52 41 44 | = P|IE * RAD|
|00003f00| 49 55 53 20 2a 20 52 41 | 44 49 55 53 0d 0a 20 20 |IUS * RA|DIUS.. |
|00003f10| 20 20 20 35 33 30 20 20 | 20 20 44 49 41 4d 45 54 | 530 | DIAMET|
|00003f20| 45 52 20 3d 20 52 41 44 | 49 55 53 20 2a 20 32 0d |ER = RAD|IUS * 2.|
|00003f30| 0a 20 20 20 20 20 35 34 | 30 20 27 0d 0a 20 20 20 |. 54|0 '.. |
|00003f40| 20 20 35 35 30 20 20 20 | 20 4c 4f 43 41 54 45 20 | 550 | LOCATE |
|00003f50| 31 34 2c 32 30 0d 0a 20 | 20 20 20 20 35 36 30 20 |14,20.. | 560 |
|00003f60| 20 20 20 50 52 49 4e 54 | 20 22 54 48 45 20 41 52 | PRINT| "THE AR|
|00003f70| 45 41 20 49 53 3a 20 20 | 20 20 20 22 3b 41 52 45 |EA IS: | ";ARE|
|00003f80| 41 3b 22 20 53 51 55 41 | 52 45 20 49 4e 43 48 45 |A;" SQUA|RE INCHE|
|00003f90| 53 22 0d 0a 20 20 20 20 | 20 35 37 30 20 20 20 20 |S".. | 570 |
|00003fa0| 4c 4f 43 41 54 45 20 31 | 35 36 2c 32 30 0d 0a 20 |LOCATE 1|56,20.. |
|00003fb0| 20 20 20 20 35 38 30 20 | 20 20 20 50 52 49 4e 54 | 580 | PRINT|
|00003fc0| 20 22 54 48 45 20 44 49 | 41 4d 45 54 45 52 20 49 | "THE DI|AMETER I|
|00003fd0| 53 3a 20 22 3b 44 49 41 | 4d 45 54 45 52 3b 22 20 |S: ";DIA|METER;" |
|00003fe0| 49 4e 43 48 45 53 22 0d | 0a 20 20 20 20 20 35 39 |INCHES".|. 59|
|00003ff0| 30 20 27 0d 0a 20 20 20 | 20 20 36 30 30 20 20 20 |0 '.. | 600 |
|00004000| 20 4c 4f 43 41 54 45 20 | 32 30 2c 31 35 0d 0a 20 | LOCATE |20,15.. |
|00004010| 20 20 20 20 36 31 30 20 | 20 20 20 49 4e 50 55 54 | 610 | INPUT|
|00004020| 20 22 44 4f 20 59 4f 55 | 20 57 41 4e 54 20 54 4f | "DO YOU| WANT TO|
|00004030| 20 4d 41 4b 45 20 41 4e | 4f 54 48 45 52 20 43 49 | MAKE AN|OTHER CI|
|00004040| 52 43 4c 45 22 3b 20 41 | 4e 53 24 0d 0a 20 20 20 |RCLE"; A|NS$.. |
|00004050| 20 20 36 32 30 20 27 0d | 0a 0d 0a 0d 0a 20 20 20 | 620 '.|..... |
|00004060| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 1b 45 | | .E|
|00004070| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004080| 1b 46 20 20 20 20 20 20 | 20 1b 45 20 20 35 35 0d |.F | .E 55.|
|00004090| 0a 0d 0a 0c 0d 0a 0d 0a | 0d 0a 0d 0a 1b 46 20 20 |........|.....F |
|000040a0| 20 20 20 1b 45 43 48 41 | 50 54 45 52 20 35 1b 46 | .ECHA|PTER 5.F|
|000040b0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 1b | | .|
|000040c0| 45 49 4e 54 45 52 41 43 | 54 49 56 45 20 50 52 4f |EINTERAC|TIVE PRO|
|000040d0| 47 52 41 4d 4d 49 4e 47 | 1b 46 20 20 20 20 20 20 |GRAMMING|.F |
|000040e0| 20 20 20 20 20 20 20 20 | 20 20 1b 45 43 48 41 50 | | .ECHAP|
|000040f0| 54 45 52 20 35 0d 0a 0d | 0a 0d 0a 20 20 20 20 20 |TER 5...|... |
|00004100| 1b 46 36 33 30 20 20 20 | 20 47 4f 53 55 42 20 37 |.F630 | GOSUB 7|
|00004110| 30 30 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |00 | |
|00004120| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004130| 20 20 20 20 20 20 20 20 | 20 27 59 45 53 20 4f 52 | | 'YES OR|
|00004140| 20 4e 4f 20 43 48 45 43 | 4b 0d 0a 20 20 20 20 20 | NO CHEC|K.. |
|00004150| 36 34 30 20 27 0d 0a 20 | 20 20 20 20 36 35 30 20 |640 '.. | 650 |
|00004160| 57 45 4e 44 0d 0a 20 20 | 20 20 20 36 30 30 20 20 |WEND.. | 600 |
|00004170| 20 20 4c 4f 43 41 54 45 | 20 32 30 2c 31 35 0d 0a | LOCATE| 20,15..|
|00004180| 20 20 20 20 20 36 31 30 | 20 20 20 20 49 4e 50 55 | 610| INPU|
|00004190| 54 20 22 44 4f 20 59 4f | 55 20 57 41 4e 54 20 54 |T "DO YO|U WANT T|
|000041a0| 4f 20 4d 41 4b 45 20 41 | 4e 4f 54 48 45 52 20 43 |O MAKE A|NOTHER C|
|000041b0| 49 52 43 4c 45 22 3b 20 | 41 4e 53 24 0d 0a 20 20 |IRCLE"; |ANS$.. |
|000041c0| 20 20 20 36 32 30 20 27 | 0d 0a 20 20 20 20 20 36 | 620 '|.. 6|
|000041d0| 33 30 20 20 20 20 47 4f | 53 55 42 20 37 30 30 20 |30 GO|SUB 700 |
|000041e0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000041f0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004200| 20 20 20 20 20 20 27 59 | 45 53 20 4f 52 20 4e 4f | 'Y|ES OR NO|
|00004210| 20 43 48 45 43 4b 0d 0a | 20 20 20 20 20 36 34 30 | CHECK..| 640|
|00004220| 20 27 0d 0a 20 20 20 20 | 20 36 35 30 20 57 45 4e | '.. | 650 WEN|
|00004230| 44 0d 0a 20 20 20 20 20 | 36 36 30 20 27 0d 0a 20 |D.. |660 '.. |
|00004240| 20 20 20 20 36 37 30 20 | 53 54 4f 50 0d 0a 20 20 | 670 |STOP.. |
|00004250| 20 20 20 37 30 30 20 27 | 0d 0a 20 20 20 20 20 37 | 700 '|.. 7|
|00004260| 31 30 20 27 20 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |10 ' ***|********|
|00004270| 2a 2a 2a 20 53 55 42 52 | 4f 55 54 49 4e 45 20 46 |*** SUBR|OUTINE F|
|00004280| 4f 52 20 59 45 53 2f 4e | 4f 20 43 48 45 43 4b 20 |OR YES/N|O CHECK |
|00004290| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 0d |********|*******.|
|000042a0| 0a 20 20 20 20 20 37 32 | 30 20 27 0d 0a 20 20 20 |. 72|0 '.. |
|000042b0| 20 20 37 33 30 20 57 48 | 49 4c 45 20 41 4e 53 24 | 730 WH|ILE ANS$|
|000042c0| 20 3c 3e 22 59 45 53 22 | 20 41 4e 44 20 41 4e 53 | <>"YES"| AND ANS|
|000042d0| 24 20 3c 3e 22 79 65 73 | 22 20 41 4e 44 20 41 4e |$ <>"yes|" AND AN|
|000042e0| 53 24 20 3c 3e 22 4e 4f | 22 20 41 4e 44 20 41 4e |S$ <>"NO|" AND AN|
|000042f0| 53 24 20 3c 3e 22 6e 6f | 22 0d 0a 20 20 20 20 20 |S$ <>"no|".. |
|00004300| 37 34 30 20 20 20 20 4c | 4f 43 41 54 45 20 32 33 |740 L|OCATE 23|
|00004310| 2c 31 35 0d 0a 20 20 20 | 20 20 37 35 30 20 20 20 |,15.. | 750 |
|00004320| 20 50 52 49 4e 54 20 22 | 20 20 20 20 20 20 20 20 | PRINT "| |
|00004330| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004340| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004350| 20 20 20 20 20 22 20 27 | 43 4c 45 41 52 20 4c 49 | " '|CLEAR LI|
|00004360| 4e 45 0d 0a 20 20 20 20 | 20 37 36 30 20 20 20 20 |NE.. | 760 |
|00004370| 4c 4f 43 41 54 45 20 32 | 33 2c 31 35 0d 0a 20 20 |LOCATE 2|3,15.. |
|00004380| 20 20 20 37 37 30 20 20 | 20 20 49 4e 50 55 54 20 | 770 | INPUT |
|00004390| 22 54 48 41 54 27 53 20 | 41 20 27 59 45 53 27 20 |"THAT'S |A 'YES' |
|000043a0| 4f 52 20 27 4e 4f 27 20 | 49 27 4d 20 4c 4f 4f 4b |OR 'NO' |I'M LOOK|
|000043b0| 49 4e 47 20 46 4f 52 22 | 3b 20 41 4e 53 24 0d 0a |ING FOR"|; ANS$..|
|000043c0| 20 20 20 20 20 37 38 30 | 20 57 45 4e 44 0d 0a 20 | 780| WEND.. |
|000043d0| 20 20 20 20 37 39 30 20 | 27 0d 0a 20 20 20 20 20 | 790 |'.. |
|000043e0| 38 30 30 20 52 45 54 55 | 52 4e 0d 0a 20 20 20 20 |800 RETU|RN.. |
|000043f0| 20 38 31 30 20 27 0d 0a | 20 20 20 20 20 38 32 30 | 810 '..| 820|
|00004400| 20 45 4e 44 0d 0a 0d 0a | 20 20 20 20 20 4e 6f 74 | END....| Not|
|00004410| 65 20 74 68 65 20 75 73 | 65 20 6f 66 20 74 68 65 |e the us|e of the|
|00004420| 20 63 6f 6d 6d 65 6e 74 | 73 20 28 27 29 20 69 6e | comment|s (') in|
|00004430| 20 74 68 65 20 61 62 6f | 76 65 20 73 6f 75 72 63 | the abo|ve sourc|
|00004440| 65 20 63 6f 64 65 2e 20 | 20 54 68 65 79 20 61 72 |e code. | They ar|
|00004450| 65 0d 0a 20 20 20 20 20 | 65 78 74 72 65 6d 65 6c |e.. |extremel|
|00004460| 79 20 68 61 6e 64 79 2e | 20 20 41 20 47 4f 53 55 |y handy.| A GOSU|
|00004470| 42 20 37 30 30 20 64 6f | 65 73 6e 27 74 20 74 65 |B 700 do|esn't te|
|00004480| 6c 6c 20 79 6f 75 20 6d | 75 63 68 20 62 79 20 69 |ll you m|uch by i|
|00004490| 74 73 65 6c 66 2e 20 20 | 41 73 20 79 6f 75 0d 0a |tself. |As you..|
|000044a0| 20 20 20 20 20 61 64 64 | 20 6d 6f 72 65 20 73 75 | add| more su|
|000044b0| 62 72 6f 75 74 69 6e 65 | 73 20 74 6f 20 79 6f 75 |broutine|s to you|
|000044c0| 72 20 70 72 6f 67 72 61 | 6d 73 2c 20 74 68 65 73 |r progra|ms, thes|
|000044d0| 65 20 63 6f 6d 6d 65 6e | 74 73 20 62 65 63 6f 6d |e commen|ts becom|
|000044e0| 65 20 6d 6f 72 65 0d 0a | 20 20 20 20 20 76 61 6c |e more..| val|
|000044f0| 75 61 62 6c 65 2e 0d 0a | 0d 0a 20 20 20 20 20 41 |uable...|.. A|
|00004500| 6e 6f 74 68 65 72 20 6e | 65 77 20 66 65 61 74 75 |nother n|ew featu|
|00004510| 72 65 20 69 73 20 74 68 | 65 20 74 65 63 68 6e 69 |re is th|e techni|
|00004520| 71 75 65 20 66 6f 72 20 | 63 6c 65 61 72 69 6e 67 |que for |clearing|
|00004530| 20 65 72 72 6f 72 73 20 | 6d 65 73 73 61 67 65 73 | errors |messages|
|00004540| 20 28 65 2e 67 2e 0d 0a | 20 20 20 20 20 6c 69 6e | (e.g...| lin|
|00004550| 65 20 37 35 30 29 2e 20 | 20 49 66 20 79 6f 75 20 |e 750). | If you |
|00004560| 64 6f 6e 27 74 20 63 6c | 65 61 72 20 61 6e 79 20 |don't cl|ear any |
|00004570| 70 72 65 76 69 6f 75 73 | 20 6d 65 73 73 61 67 65 |previous| message|
|00004580| 73 20 6f 6e 20 74 68 61 | 74 20 6c 69 6e 65 20 79 |s on tha|t line y|
|00004590| 6f 75 0d 0a 20 20 20 20 | 20 77 69 6c 6c 20 65 6e |ou.. | will en|
|000045a0| 64 20 75 70 20 77 69 74 | 68 20 61 20 63 6f 6e 66 |d up wit|h a conf|
|000045b0| 75 73 69 6e 67 20 67 61 | 72 62 6c 65 2e 20 20 54 |using ga|rble. T|
|000045c0| 61 6b 65 20 74 68 65 20 | 6c 69 6e 65 20 6f 75 74 |ake the |line out|
|000045d0| 20 6f 66 20 79 6f 75 72 | 20 70 72 6f 67 72 61 6d | of your| program|
|000045e0| 0d 0a 20 20 20 20 20 61 | 6e 64 20 72 75 6e 20 69 |.. a|nd run i|
|000045f0| 74 20 61 67 61 69 6e 20 | 74 6f 20 73 65 65 20 77 |t again |to see w|
|00004600| 68 61 74 20 77 65 20 6d | 65 61 6e 2e 20 20 52 65 |hat we m|ean. Re|
|00004610| 6d 65 6d 62 65 72 2c 20 | 74 68 69 73 20 77 69 6c |member, |this wil|
|00004620| 6c 20 6f 6e 6c 79 20 73 | 68 6f 77 20 75 70 0d 0a |l only s|how up..|
|00004630| 20 20 20 20 20 69 66 20 | 79 6f 75 20 69 6e 74 72 | if |you intr|
|00004640| 6f 64 75 63 65 20 64 65 | 6c 69 62 65 72 61 74 65 |oduce de|liberate|
|00004650| 20 65 72 72 6f 72 73 2e | 0d 0a 0d 0a 20 20 20 20 | errors.|.... |
|00004660| 20 59 6f 75 20 6d 61 79 | 20 6e 6f 74 20 6e 65 63 | You may| not nec|
|00004670| 65 73 73 61 72 69 6c 79 | 20 77 61 6e 74 20 74 6f |essarily| want to|
|00004680| 20 75 73 65 20 74 68 65 | 20 4c 4f 43 41 54 45 20 | use the| LOCATE |
|00004690| 63 6f 6d 6d 61 6e 64 20 | 61 6c 6c 20 74 68 65 20 |command |all the |
|000046a0| 74 69 6d 65 2e 20 20 49 | 66 0d 0a 20 20 20 20 20 |time. I|f.. |
|000046b0| 79 6f 75 20 61 72 65 20 | 63 72 65 61 74 69 6e 67 |you are |creating|
|000046c0| 20 61 20 74 61 62 6c 65 | 20 61 6e 64 20 77 61 6e | a table| and wan|
|000046d0| 74 20 74 6f 20 70 72 69 | 6e 74 20 73 75 63 63 65 |t to pri|nt succe|
|000046e0| 73 73 69 76 65 20 6c 69 | 6e 65 73 20 6f 6e 20 74 |ssive li|nes on t|
|000046f0| 68 65 0d 0a 20 20 20 20 | 20 73 63 72 65 65 6e 2c |he.. | screen,|
|00004700| 20 61 20 4c 4f 43 41 54 | 45 20 63 6f 75 6c 64 20 | a LOCAT|E could |
|00004710| 74 61 6b 65 20 79 6f 75 | 20 74 6f 20 74 68 65 20 |take you| to the |
|00004720| 66 69 72 73 74 20 6f 75 | 74 70 75 74 20 6c 69 6e |first ou|tput lin|
|00004730| 65 20 62 75 74 20 6d 61 | 79 20 6e 6f 74 0d 0a 20 |e but ma|y not.. |
|00004740| 20 20 20 20 6d 61 6b 65 | 20 61 20 6c 6f 74 20 6f | make| a lot o|
|00004750| 66 20 73 65 6e 73 65 20 | 61 66 74 65 72 20 74 68 |f sense |after th|
|00004760| 61 74 2e 20 20 54 68 61 | 74 27 73 20 74 68 65 20 |at. Tha|t's the |
|00004770| 63 75 72 73 65 20 6f 66 | 20 61 63 71 75 69 72 69 |curse of| acquiri|
|00004780| 6e 67 20 74 6f 6f 6c 73 | 2c 0d 0a 20 20 20 20 20 |ng tools|,.. |
|00004790| 79 6f 75 20 68 61 76 65 | 20 74 6f 20 6d 61 6b 65 |you have| to make|
|000047a0| 20 64 65 63 69 73 69 6f | 6e 73 20 6f 6e 20 77 68 | decisio|ns on wh|
|000047b0| 61 74 20 74 6f 20 75 73 | 65 20 77 68 65 72 65 2c |at to us|e where,|
|000047c0| 20 61 6e 64 20 68 6f 77 | 20 74 6f 20 75 73 65 20 | and how| to use |
|000047d0| 69 74 2e 0d 0a 20 20 20 | 20 20 59 65 73 2c 20 70 |it... | Yes, p|
|000047e0| 72 6f 67 72 61 6d 6d 69 | 6e 67 20 72 65 71 75 69 |rogrammi|ng requi|
|000047f0| 72 65 73 20 79 6f 75 20 | 74 6f 20 74 68 69 6e 6b |res you |to think|
|00004800| 20 61 6e 64 20 6d 61 6b | 65 20 64 65 63 69 73 69 | and mak|e decisi|
|00004810| 6f 6e 73 2e 0d 0a 0d 0a | 20 20 20 20 20 48 6f 77 |ons.....| How|
|00004820| 20 64 6f 20 79 6f 75 20 | 66 6c 6f 77 63 68 61 72 | do you |flowchar|
|00004830| 74 20 74 68 65 20 6c 61 | 73 74 20 76 65 72 73 69 |t the la|st versi|
|00004840| 6f 6e 20 6f 66 20 6f 75 | 72 20 70 72 6f 67 72 61 |on of ou|r progra|
|00004850| 6d 3f 20 20 54 75 72 6e | 20 74 6f 20 74 68 65 20 |m? Turn| to the |
|00004860| 6e 65 78 74 0d 0a 20 20 | 20 20 20 70 61 67 65 2e |next.. | page.|
|00004870| 0d 0a 0d 0a 0d 0a 0d 0a | 0d 0a 0d 0a 0d 0a 0d 0a |........|........|
|00004880| 0d 0a 0d 0a 0d 0a 20 20 | 20 20 20 20 20 20 20 20 |...... | |
|00004890| 20 20 20 20 20 20 20 1b | 45 20 20 20 20 20 20 20 | .|E |
|000048a0| 20 20 20 20 20 20 20 20 | 20 1b 46 20 20 20 20 20 | | .F |
|000048b0| 20 20 1b 45 20 20 35 36 | 0d 0a 0d 0a 0c 0d 0a 0d | .E 56|........|
|000048c0| 0a 0d 0a 0d 0a 1b 46 20 | 20 20 20 20 1b 45 43 48 |......F | .ECH|
|000048d0| 41 50 54 45 52 20 35 1b | 46 20 20 20 20 20 20 20 |APTER 5.|F |
|000048e0| 20 20 20 20 20 20 20 20 | 1b 45 49 4e 54 45 52 41 | |.EINTERA|
|000048f0| 43 54 49 56 45 20 50 52 | 4f 47 52 41 4d 4d 49 4e |CTIVE PR|OGRAMMIN|
|00004900| 47 1b 46 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |G.F | |
|00004910| 20 20 20 1b 45 43 48 41 | 50 54 45 52 20 35 0d 0a | .ECHA|PTER 5..|
|00004920| 0d 0a 0d 0a 0d 0a 0d 0a | 0d 0a 0d 0a 0d 0a 0d 0a |........|........|
|00004930| 0d 0a 0d 0a 0d 0a 0d 0a | 0d 0a 0d 0a 0d 0a 0d 0a |........|........|
|00004940| 0d 0a 0d 0a 0d 0a 0d 0a | 0d 0a 0d 0a 0d 0a 0d 0a |........|........|
|00004950| 0d 0a 0d 0a 0d 0a 0d 0a | 0d 0a 0d 0a 0d 0a 0d 0a |........|........|
|00004960| 0d 0a 0d 0a 0d 0a 0d 0a | 0d 0a 0d 0a 0d 0a 0d 0a |........|........|
|00004970| 0d 0a 0d 0a 0d 0a 0d 0a | 0d 0a 0d 0a 0d 0a 0d 0a |........|........|
|00004980| 0d 0a 0d 0a 0d 0a 0d 0a | 0d 0a 0d 0a 0d 0a 0d 0a |........|........|
|00004990| 0d 0a 1b 46 20 20 20 20 | 20 20 20 20 20 20 20 20 |...F | |
|000049a0| 20 20 20 20 20 1b 45 20 | 20 20 20 20 20 20 20 20 | .E | |
|000049b0| 20 20 20 20 20 20 20 1b | 46 20 20 20 20 20 20 20 | .|F |
|000049c0| 1b 45 20 20 35 37 0d 0a | 0d 0a 0c 0d 0a 0d 0a 0d |.E 57..|........|
|000049d0| 0a 0d 0a 1b 46 20 20 20 | 20 20 1b 45 43 48 41 50 |....F | .ECHAP|
|000049e0| 54 45 52 20 35 1b 46 20 | 20 20 20 20 20 20 20 20 |TER 5.F | |
|000049f0| 20 20 20 20 20 20 1b 45 | 49 4e 54 45 52 41 43 54 | .E|INTERACT|
|00004a00| 49 56 45 20 50 52 4f 47 | 52 41 4d 4d 49 4e 47 1b |IVE PROG|RAMMING.|
|00004a10| 46 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |F | |
|00004a20| 20 1b 45 43 48 41 50 54 | 45 52 20 35 0d 0a 0d 0a | .ECHAPT|ER 5....|
|00004a30| 0d 0a 20 20 20 20 20 46 | 4f 52 2f 4e 45 58 54 20 |.. F|OR/NEXT |
|00004a40| 4c 4f 4f 50 53 0d 0a 0d | 0a 20 20 20 20 20 1b 46 |LOOPS...|. .F|
|00004a50| 42 65 66 6f 72 65 20 77 | 65 20 74 75 72 6e 20 79 |Before w|e turn y|
|00004a60| 6f 75 20 6f 76 65 72 20 | 74 6f 20 74 68 65 20 73 |ou over |to the s|
|00004a70| 79 73 74 65 6d 73 20 61 | 6e 61 6c 79 73 74 2c 20 |ystems a|nalyst, |
|00004a80| 77 65 27 6c 6c 20 69 6e | 74 72 6f 64 75 63 65 20 |we'll in|troduce |
|00004a90| 6f 6e 65 20 6d 6f 72 65 | 0d 0a 20 20 20 20 20 6e |one more|.. n|
|00004aa0| 65 77 20 74 6f 6f 6c 2c | 20 74 68 65 20 46 4f 52 |ew tool,| the FOR|
|00004ab0| 2f 4e 45 58 54 20 6c 6f | 6f 70 2e 20 20 57 68 6f |/NEXT lo|op. Who|
|00004ac0| 20 6b 6e 6f 77 73 2c 20 | 69 74 20 6d 69 67 68 74 | knows, |it might|
|00004ad0| 20 65 76 65 6e 20 68 65 | 6c 70 20 79 6f 75 20 77 | even he|lp you w|
|00004ae0| 69 74 68 20 6f 6e 65 0d | 0a 20 20 20 20 20 6f 66 |ith one.|. of|
|00004af0| 20 68 69 73 20 61 73 73 | 69 67 6e 6d 65 6e 74 73 | his ass|ignments|
|00004b00| 2e 20 20 41 20 46 4f 52 | 2f 4e 45 58 54 20 6c 6f |. A FOR|/NEXT lo|
|00004b10| 6f 70 20 69 73 20 73 68 | 6f 77 6e 20 62 65 6c 6f |op is sh|own belo|
|00004b20| 77 3a 0d 0a 0d 0a 20 20 | 20 20 20 31 30 30 20 46 |w:.... | 100 F|
|00004b30| 4f 52 20 49 20 3d 20 31 | 20 54 4f 20 31 35 0d 0a |OR I = 1| TO 15..|
|00004b40| 20 20 20 20 20 31 31 30 | 20 20 20 50 52 49 4e 54 | 110| PRINT|
|00004b50| 20 49 0d 0a 20 20 20 20 | 20 31 32 30 20 4e 45 58 | I.. | 120 NEX|
|00004b60| 54 20 49 0d 0a 0d 0a 20 | 20 20 20 20 55 6e 6c 69 |T I.... | Unli|
|00004b70| 6b 65 20 74 68 65 20 57 | 48 49 4c 45 2f 57 45 4e |ke the W|HILE/WEN|
|00004b80| 44 20 6c 6f 6f 70 2c 20 | 74 68 65 20 46 4f 52 2f |D loop, |the FOR/|
|00004b90| 4e 45 58 54 20 6c 6f 6f | 70 20 67 6f 65 73 20 61 |NEXT loo|p goes a|
|00004ba0| 72 6f 75 6e 64 20 61 20 | 66 69 78 65 64 20 6e 75 |round a |fixed nu|
|00004bb0| 6d 62 65 72 0d 0a 20 20 | 20 20 20 6f 66 20 74 69 |mber.. | of ti|
|00004bc0| 6d 65 73 2e 20 20 54 68 | 65 20 61 62 6f 76 65 20 |mes. Th|e above |
|00004bd0| 6c 6f 6f 70 2c 20 66 6f | 72 20 69 6e 73 74 61 6e |loop, fo|r instan|
|00004be0| 63 65 2c 20 77 69 6c 6c | 20 67 6f 20 61 72 6f 75 |ce, will| go arou|
|00004bf0| 6e 64 20 66 69 66 74 65 | 65 6e 20 74 69 6d 65 73 |nd fifte|en times|
|00004c00| 2e 0d 0a 20 20 20 20 20 | 54 6f 20 64 6f 20 74 68 |... |To do th|
|00004c10| 69 73 2c 20 69 74 20 6e | 65 65 64 73 20 61 20 63 |is, it n|eeds a c|
|00004c20| 6f 75 6e 74 65 72 2e 20 | 20 54 68 69 73 20 65 78 |ounter. | This ex|
|00004c30| 61 6d 70 6c 65 20 75 73 | 65 73 20 74 68 65 20 76 |ample us|es the v|
|00004c40| 61 72 69 61 62 6c 65 20 | 49 20 61 73 20 61 0d 0a |ariable |I as a..|
|00004c50| 20 20 20 20 20 63 6f 75 | 6e 74 65 72 2e 20 20 49 | cou|nter. I|
|00004c60| 20 67 65 74 73 20 73 65 | 74 20 74 6f 20 31 20 28 | gets se|t to 1 (|
|00004c70| 46 4f 52 20 49 20 3d 20 | 31 20 2e 2e 2e 29 20 61 |FOR I = |1 ...) a|
|00004c80| 6e 64 20 74 68 65 6e 20 | 74 68 65 20 6c 6f 6f 70 |nd then |the loop|
|00004c90| 20 73 74 61 72 74 73 2e | 20 20 54 68 65 0d 0a 20 | starts.| The.. |
|00004ca0| 20 20 20 20 6c 6f 6f 70 | 20 65 6e 64 73 20 61 74 | loop| ends at|
|00004cb0| 20 74 68 65 20 4e 45 58 | 54 20 73 74 61 74 65 6d | the NEX|T statem|
|00004cc0| 65 6e 74 2e 20 20 4e 45 | 58 54 20 6d 65 61 6e 73 |ent. NE|XT means|
|00004cd0| 20 22 61 64 64 20 31 20 | 74 6f 20 79 6f 75 72 20 | "add 1 |to your |
|00004ce0| 63 6f 75 6e 74 65 72 20 | 61 6e 64 0d 0a 20 20 20 |counter |and.. |
|00004cf0| 20 20 67 6f 20 62 61 63 | 6b 20 74 6f 20 74 68 65 | go bac|k to the|
|00004d00| 20 46 4f 52 22 2e 20 20 | 57 68 61 74 20 66 6f 72 | FOR". |What for|
|00004d10| 3f 20 20 42 65 63 61 75 | 73 65 20 74 68 65 20 46 |? Becau|se the F|
|00004d20| 4f 52 20 73 74 61 74 65 | 6d 65 6e 74 20 64 65 74 |OR state|ment det|
|00004d30| 65 72 6d 69 6e 65 73 0d | 0a 20 20 20 20 20 68 6f |ermines.|. ho|
|00004d40| 77 20 6c 6f 6e 67 20 79 | 6f 75 20 6c 6f 6f 70 2e |w long y|ou loop.|
|00004d50| 20 20 42 41 53 49 43 20 | 74 65 73 74 73 20 74 68 | BASIC |tests th|
|00004d60| 65 20 76 61 6c 75 65 20 | 6f 66 20 49 2e 20 20 49 |e value |of I. I|
|00004d70| 6e 20 74 68 65 20 61 62 | 6f 76 65 20 63 61 73 65 |n the ab|ove case|
|00004d80| 2c 20 77 68 65 6e 0d 0a | 20 20 20 20 20 49 20 77 |, when..| I w|
|00004d90| 6f 72 6b 73 20 69 74 73 | 20 77 61 79 20 75 70 20 |orks its| way up |
|00004da0| 74 6f 20 31 36 2c 20 74 | 68 65 20 6c 6f 6f 70 20 |to 16, t|he loop |
|00004db0| 73 74 6f 70 73 2c 20 61 | 6e 64 20 74 68 65 20 70 |stops, a|nd the p|
|00004dc0| 72 6f 67 72 61 6d 20 77 | 69 6c 6c 20 6a 75 6d 70 |rogram w|ill jump|
|00004dd0| 20 74 6f 0d 0a 20 20 20 | 20 20 77 68 61 74 65 76 | to.. | whatev|
|00004de0| 65 72 20 6c 69 6e 65 20 | 66 6f 6c 6c 6f 77 73 20 |er line |follows |
|00004df0| 4e 45 58 54 20 49 2e 0d | 0a 0d 0a 20 20 20 20 20 |NEXT I..|... |
|00004e00| 54 68 65 20 76 61 72 69 | 61 62 6c 65 20 6e 61 6d |The vari|able nam|
|00004e10| 65 20 49 20 69 73 20 61 | 72 62 69 74 72 61 72 79 |e I is a|rbitrary|
|00004e20| 2c 20 77 65 20 63 6f 75 | 6c 64 20 6a 75 73 74 20 |, we cou|ld just |
|00004e30| 61 73 20 65 61 73 69 6c | 79 20 68 61 76 65 20 75 |as easil|y have u|
|00004e40| 73 65 64 20 57 45 0d 0a | 20 20 20 20 20 73 69 6e |sed WE..| sin|
|00004e50| 63 65 20 74 68 65 72 65 | 20 69 73 20 63 6f 6d 66 |ce there| is comf|
|00004e60| 6f 72 74 20 69 6e 20 6e | 75 6d 62 65 72 73 2c 20 |ort in n|umbers, |
|00004e70| 6f 72 20 4b 2e 20 20 54 | 68 65 20 72 61 6e 67 65 |or K. T|he range|
|00004e80| 20 6f 66 20 74 68 65 20 | 6c 6f 6f 70 20 69 73 0d | of the |loop is.|
|00004e90| 0a 20 20 20 20 20 64 65 | 66 69 6e 65 64 20 62 79 |. de|fined by|
|00004ea0| 20 79 6f 75 2e 20 20 41 | 73 73 75 6d 65 20 74 68 | you. A|ssume th|
|00004eb0| 61 74 20 79 6f 75 20 77 | 61 6e 74 20 74 6f 20 6c |at you w|ant to l|
|00004ec0| 6f 6f 70 20 33 30 20 74 | 69 6d 65 73 2e 20 20 54 |oop 30 t|imes. T|
|00004ed0| 68 65 6e 20 72 65 73 75 | 6c 74 61 6e 74 0d 0a 20 |hen resu|ltant.. |
|00004ee0| 20 20 20 20 6c 6f 6f 70 | 20 69 73 20 63 6f 64 65 | loop| is code|
|00004ef0| 64 20 61 73 20 66 6f 6c | 6c 6f 77 73 3a 0d 0a 0d |d as fol|lows:...|
|00004f00| 0a 20 20 20 20 20 31 30 | 30 20 46 4f 52 20 57 45 |. 10|0 FOR WE|
|00004f10| 20 3d 20 31 20 54 4f 20 | 33 30 0d 0a 20 20 20 20 | = 1 TO |30.. |
|00004f20| 20 31 31 30 20 20 20 20 | 50 52 49 4e 54 20 57 45 | 110 |PRINT WE|
|00004f30| 0d 0a 20 20 20 20 20 31 | 32 30 20 4e 45 58 54 20 |.. 1|20 NEXT |
|00004f40| 57 45 0d 0a 0d 0a 20 20 | 20 20 20 59 6f 75 20 63 |WE.... | You c|
|00004f50| 61 6e 20 61 6c 73 6f 20 | 63 68 61 6e 67 65 20 74 |an also |change t|
|00004f60| 68 65 20 69 6e 63 72 65 | 6d 65 6e 74 2e 20 20 42 |he incre|ment. B|
|00004f70| 79 20 64 65 66 61 75 6c | 74 2c 20 42 41 53 49 43 |y defaul|t, BASIC|
|00004f80| 20 61 64 64 73 20 31 20 | 65 76 65 72 79 20 74 69 | adds 1 |every ti|
|00004f90| 6d 65 0d 0a 20 20 20 20 | 20 74 68 65 20 4e 45 58 |me.. | the NEX|
|00004fa0| 54 20 73 74 61 74 65 6d | 65 6e 74 20 69 73 20 65 |T statem|ent is e|
|00004fb0| 6e 63 6f 75 6e 74 65 72 | 65 64 2e 20 20 49 66 20 |ncounter|ed. If |
|00004fc0| 79 6f 75 20 77 61 6e 74 | 20 69 74 20 74 6f 20 61 |you want| it to a|
|00004fd0| 64 64 20 73 6f 6d 65 74 | 68 69 6e 67 0d 0a 20 20 |dd somet|hing.. |
|00004fe0| 20 20 20 64 69 66 66 65 | 72 65 6e 74 20 6c 69 6b | diffe|rent lik|
|00004ff0| 65 20 32 2c 20 79 6f 75 | 20 74 61 63 6b 20 61 6e |e 2, you| tack an|
|00005000| 20 49 4e 43 20 28 66 6f | 72 20 69 6e 63 72 65 6d | INC (fo|r increm|
|00005010| 65 6e 74 29 20 6f 6e 20 | 74 6f 20 79 6f 75 72 20 |ent) on |to your |
|00005020| 46 4f 52 0d 0a 20 20 20 | 20 20 69 6e 73 74 72 75 |FOR.. | instru|
|00005030| 63 74 69 6f 6e 3a 0d 0a | 0d 0a 20 20 20 20 20 31 |ction:..|.. 1|
|00005040| 30 30 20 46 4f 52 20 4b | 20 3d 20 31 20 54 4f 20 |00 FOR K| = 1 TO |
|00005050| 38 33 20 49 4e 43 20 32 | 0d 0a 20 20 20 20 20 31 |83 INC 2|.. 1|
|00005060| 31 30 20 20 20 50 52 49 | 4e 54 20 4b 0d 0a 20 20 |10 PRI|NT K.. |
|00005070| 20 20 20 31 32 30 20 4e | 45 58 54 20 4b 0d 0a 0d | 120 N|EXT K...|
|00005080| 0a 20 20 20 20 20 59 6f | 75 20 63 61 6e 20 65 76 |. Yo|u can ev|
|00005090| 65 6e 20 67 6f 20 62 61 | 63 6b 77 61 72 64 73 20 |en go ba|ckwards |
|000050a0| 62 75 74 20 79 6f 75 27 | 6c 6c 20 6e 65 65 64 20 |but you'|ll need |
|000050b0| 74 6f 20 72 65 76 65 72 | 73 65 20 74 68 65 20 6c |to rever|se the l|
|000050c0| 69 6d 69 74 73 20 61 6e | 64 20 75 73 65 0d 0a 20 |imits an|d use.. |
|000050d0| 20 20 20 20 61 20 6e 65 | 67 61 74 69 76 65 20 69 | a ne|gative i|
|000050e0| 6e 63 72 65 6d 65 6e 74 | 3a 0d 0a 0d 0a 20 20 20 |ncrement|:.... |
|000050f0| 20 20 31 30 30 20 46 4f | 52 20 43 4e 54 20 3d 20 | 100 FO|R CNT = |
|00005100| 33 30 20 54 4f 20 31 20 | 49 4e 43 20 2d 31 0d 0a |30 TO 1 |INC -1..|
|00005110| 20 20 20 20 20 31 31 30 | 20 20 20 50 52 49 4e 54 | 110| PRINT|
|00005120| 20 43 4e 54 0d 0a 20 20 | 20 20 20 31 32 30 20 4e | CNT.. | 120 N|
|00005130| 45 58 54 20 43 4e 54 0d | 0a 0d 0a 20 20 20 20 20 |EXT CNT.|... |
|00005140| 4c 61 73 74 20 62 75 74 | 20 6e 6f 74 20 6c 65 61 |Last but| not lea|
|00005150| 73 74 2c 20 79 6f 75 20 | 63 61 6e 20 75 73 65 20 |st, you |can use |
|00005160| 76 61 72 69 61 62 6c 65 | 73 20 66 6f 72 20 6c 69 |variable|s for li|
|00005170| 6d 69 74 73 20 61 73 20 | 6c 6f 6e 67 20 61 73 20 |mits as |long as |
|00005180| 74 68 65 79 0d 0a 20 20 | 20 20 20 68 61 76 65 20 |they.. | have |
|00005190| 62 65 65 6e 20 70 72 65 | 76 69 6f 75 73 6c 79 20 |been pre|viously |
|000051a0| 64 65 66 69 6e 65 64 20 | 69 6e 20 79 6f 75 72 20 |defined |in your |
|000051b0| 70 72 6f 67 72 61 6d 2e | 20 20 54 68 65 20 76 61 |program.| The va|
|000051c0| 72 69 61 62 6c 65 20 63 | 61 6e 20 61 0d 0a 20 20 |riable c|an a.. |
|000051d0| 20 20 20 63 6f 6e 73 74 | 61 6e 74 2c 20 61 6e 20 | const|ant, an |
|000051e0| 69 6e 70 75 74 20 76 61 | 72 69 61 62 6c 65 20 6f |input va|riable o|
|000051f0| 72 20 61 20 63 61 6c 63 | 75 6c 61 74 65 64 20 76 |r a calc|ulated v|
|00005200| 61 72 69 61 62 6c 65 3a | 0d 0a 0d 0a 20 20 20 20 |ariable:|.... |
|00005210| 20 31 30 30 20 4c 41 53 | 54 20 3d 20 32 30 0d 0a | 100 LAS|T = 20..|
|00005220| 20 20 20 20 20 31 31 30 | 20 46 4f 52 20 50 20 3d | 110| FOR P =|
|00005230| 20 31 20 54 4f 20 4c 41 | 53 54 0d 0a 20 20 20 20 | 1 TO LA|ST.. |
|00005240| 20 31 32 30 20 20 20 50 | 52 49 4e 54 20 50 0d 0a | 120 P|RINT P..|
|00005250| 20 20 20 20 20 31 33 30 | 20 4e 45 58 54 20 50 0d | 130| NEXT P.|
|00005260| 0a 0d 0a 0d 0a 20 20 20 | 20 20 20 20 20 20 20 20 |..... | |
|00005270| 20 20 20 20 20 20 1b 45 | 20 20 20 20 20 20 20 20 | .E| |
|00005280| 20 20 20 20 20 20 20 20 | 1b 46 20 20 20 20 20 20 | |.F |
|00005290| 20 1b 45 20 20 35 38 0d | 0a 0d 0a 0c 0d 0a 0d 0a | .E 58.|........|
|000052a0| 0d 0a 0d 0a 1b 46 20 20 | 20 20 20 1b 45 43 48 41 |.....F | .ECHA|
|000052b0| 50 54 45 52 20 35 1b 46 | 20 20 20 20 20 20 20 20 |PTER 5.F| |
|000052c0| 20 20 20 20 20 20 20 1b | 45 49 4e 54 45 52 41 43 | .|EINTERAC|
|000052d0| 54 49 56 45 20 50 52 4f | 47 52 41 4d 4d 49 4e 47 |TIVE PRO|GRAMMING|
|000052e0| 1b 46 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |.F | |
|000052f0| 20 20 1b 45 43 48 41 50 | 54 45 52 20 35 0d 0a 0d | .ECHAP|TER 5...|
|00005300| 0a 0d 0a 20 20 20 20 20 | 1b 46 54 68 65 20 46 4f |... |.FThe FO|
|00005310| 52 2f 4e 45 58 54 20 69 | 6e 73 74 72 75 63 74 69 |R/NEXT i|nstructi|
|00005320| 6f 6e 20 69 73 20 61 20 | 63 6f 6e 63 69 73 65 20 |on is a |concise |
|00005330| 77 61 79 20 6f 66 20 6c | 6f 6f 70 69 6e 67 20 61 |way of l|ooping a|
|00005340| 20 66 69 78 65 64 20 6e | 75 6d 62 65 72 20 6f 66 | fixed n|umber of|
|00005350| 0d 0a 20 20 20 20 20 74 | 69 6d 65 73 2e 20 20 59 |.. t|imes. Y|
|00005360| 6f 75 20 63 61 6e 20 75 | 73 65 20 74 68 65 20 57 |ou can u|se the W|
|00005370| 48 49 4c 45 2f 57 45 4e | 44 20 66 6f 72 20 74 68 |HILE/WEN|D for th|
|00005380| 69 73 20 74 61 73 6b 2c | 20 62 75 74 20 79 6f 75 |is task,| but you|
|00005390| 27 6c 6c 20 68 61 76 65 | 20 74 6f 20 61 64 64 0d |'ll have| to add.|
|000053a0| 0a 20 20 20 20 20 74 68 | 65 20 74 65 73 74 69 6e |. th|e testin|
|000053b0| 67 20 61 6e 64 20 69 6e | 63 72 65 6d 65 6e 74 20 |g and in|crement |
|000053c0| 6c 6f 67 69 63 2e 20 20 | 48 65 72 65 27 73 20 61 |logic. |Here's a|
|000053d0| 20 57 48 49 4c 45 2f 57 | 45 4e 44 20 69 6d 70 6c | WHILE/W|END impl|
|000053e0| 65 6d 65 6e 74 61 74 69 | 6f 6e 20 6f 66 0d 0a 20 |ementati|on of.. |
|000053f0| 20 20 20 20 74 68 65 20 | 73 61 6d 65 20 6c 6f 6f | the |same loo|
|00005400| 70 3a 0d 0a 0d 0a 20 20 | 20 20 20 31 30 30 20 4c |p:.... | 100 L|
|00005410| 41 53 54 20 3d 20 32 30 | 0d 0a 20 20 20 20 20 31 |AST = 20|.. 1|
|00005420| 31 30 20 50 20 20 20 20 | 3d 20 31 0d 0a 20 20 20 |10 P |= 1.. |
|00005430| 20 20 31 32 30 20 57 48 | 49 4c 45 20 50 20 3c 3d | 120 WH|ILE P <=|
|00005440| 20 4c 41 53 54 0d 0a 20 | 20 20 20 20 31 33 30 20 | LAST.. | 130 |
|00005450| 20 20 50 52 49 4e 54 20 | 50 0d 0a 20 20 20 20 20 | PRINT |P.. |
|00005460| 31 34 30 20 20 20 50 20 | 3d 20 50 20 2b 20 31 0d |140 P |= P + 1.|
|00005470| 0a 20 20 20 20 20 31 35 | 30 20 57 45 4e 44 0d 0a |. 15|0 WEND..|
|00005480| 0d 0a 20 20 20 20 20 54 | 68 65 20 46 4f 52 2f 4e |.. T|he FOR/N|
|00005490| 45 58 54 20 6c 6f 6f 70 | 20 63 6f 6d 65 73 20 69 |EXT loop| comes i|
|000054a0| 6e 20 68 61 6e 64 79 20 | 66 6f 72 20 61 20 6c 6f |n handy |for a lo|
|000054b0| 74 20 6f 66 20 61 70 70 | 6c 69 63 61 74 69 6f 6e |t of app|lication|
|000054c0| 73 2e 20 20 46 6f 72 0d | 0a 20 20 20 20 20 65 78 |s. For.|. ex|
|000054d0| 61 6d 70 6c 65 2c 20 69 | 66 20 79 6f 75 20 68 61 |ample, i|f you ha|
|000054e0| 64 20 74 6f 20 77 72 69 | 74 65 20 61 20 70 72 6f |d to wri|te a pro|
|000054f0| 67 72 61 6d 20 74 68 61 | 74 20 70 72 6f 64 75 63 |gram tha|t produc|
|00005500| 65 64 20 61 20 74 61 62 | 6c 65 20 6f 66 20 74 68 |ed a tab|le of th|
|00005510| 65 20 63 6f 73 74 0d 0a | 20 20 20 20 20 6f 66 20 |e cost..| of |
|00005520| 63 61 6e 73 20 6f 66 20 | 73 69 6c 6c 79 20 70 75 |cans of |silly pu|
|00005530| 74 74 79 2c 20 79 6f 75 | 72 20 6d 61 69 6e 20 6c |tty, you|r main l|
|00005540| 6f 67 69 63 20 6d 69 67 | 68 74 20 69 6e 63 6c 75 |ogic mig|ht inclu|
|00005550| 64 65 20 74 68 65 20 66 | 6f 6c 6c 6f 77 69 6e 67 |de the f|ollowing|
|00005560| 0d 0a 20 20 20 20 20 63 | 6f 64 65 3a 0d 0a 0d 0a |.. c|ode:....|
|00005570| 20 20 20 20 20 32 34 30 | 20 46 4d 54 31 24 20 3d | 240| FMT1$ =|
|00005580| 20 22 23 23 20 20 20 20 | 20 20 20 20 20 20 20 23 | "## | #|
|00005590| 2c 23 23 23 2e 23 23 22 | 0d 0a 20 20 20 20 20 32 |,###.##"|.. 2|
|000055a0| 35 30 20 43 41 4e 2e 50 | 52 49 43 45 20 3d 20 31 |50 CAN.P|RICE = 1|
|000055b0| 2e 32 35 0d 0a 20 20 20 | 20 20 34 30 30 20 49 4e |.25.. | 400 IN|
|000055c0| 50 55 54 20 22 48 4f 57 | 20 4d 41 4e 59 20 43 41 |PUT "HOW| MANY CA|
|000055d0| 4e 53 20 49 4e 20 54 48 | 45 20 54 41 42 4c 45 22 |NS IN TH|E TABLE"|
|000055e0| 3b 20 54 4f 54 41 4c 0d | 0a 20 20 20 20 20 34 31 |; TOTAL.|. 41|
|000055f0| 30 20 57 48 49 4c 45 20 | 54 4f 54 41 4c 20 3c 20 |0 WHILE |TOTAL < |
|00005600| 31 20 4f 52 20 54 4f 54 | 41 4c 20 3e 20 32 30 0d |1 OR TOT|AL > 20.|
|00005610| 0a 20 20 20 20 20 34 32 | 30 20 20 20 20 49 4e 50 |. 42|0 INP|
|00005620| 55 54 20 22 50 4c 45 41 | 53 45 20 45 4e 54 45 52 |UT "PLEA|SE ENTER|
|00005630| 20 41 20 4e 55 4d 42 45 | 52 20 46 52 4f 4d 20 31 | A NUMBE|R FROM 1|
|00005640| 20 54 4f 20 32 30 22 3b | 20 54 4f 54 41 4c 0d 0a | TO 20";| TOTAL..|
|00005650| 20 20 20 20 20 34 33 30 | 20 57 45 4e 44 0d 0a 20 | 430| WEND.. |
|00005660| 20 20 20 20 34 34 30 20 | 27 0d 0a 20 20 20 20 20 | 440 |'.. |
|00005670| 34 35 30 20 50 52 49 4e | 54 0d 0a 20 20 20 20 20 |450 PRIN|T.. |
|00005680| 34 36 30 20 50 52 49 4e | 54 20 22 4e 55 4d 42 45 |460 PRIN|T "NUMBE|
|00005690| 52 20 20 20 20 20 20 20 | 20 20 20 20 20 20 43 4f |R | CO|
|000056a0| 53 54 22 0d 0a 20 20 20 | 20 20 34 37 30 20 50 52 |ST".. | 470 PR|
|000056b0| 49 4e 54 0d 0a 20 20 20 | 20 20 34 38 30 20 27 0d |INT.. | 480 '.|
|000056c0| 0a 20 20 20 20 20 34 39 | 30 20 46 4f 52 20 4e 55 |. 49|0 FOR NU|
|000056d0| 4d 20 3d 20 31 20 54 4f | 20 54 4f 54 41 4c 0d 0a |M = 1 TO| TOTAL..|
|000056e0| 20 20 20 20 20 35 30 30 | 20 20 20 20 43 4f 53 54 | 500| COST|
|000056f0| 20 3d 20 4e 55 4d 20 2a | 20 43 41 4e 2e 50 52 49 | = NUM *| CAN.PRI|
|00005700| 43 45 0d 0a 20 20 20 20 | 20 35 31 30 20 20 20 20 |CE.. | 510 |
|00005710| 50 52 49 4e 54 20 55 53 | 49 4e 47 20 46 4d 54 31 |PRINT US|ING FMT1|
|00005720| 24 3b 20 4e 55 4d 2c 20 | 43 4f 53 54 0d 0a 20 20 |$; NUM, |COST.. |
|00005730| 20 20 20 35 32 30 20 4e | 45 58 54 20 4e 55 4d 0d | 520 N|EXT NUM.|
|00005740| 0a 20 20 20 20 20 35 33 | 30 20 27 0d 0a 20 20 20 |. 53|0 '.. |
|00005750| 20 20 35 34 30 20 50 52 | 49 4e 54 0d 0a 0d 0a 20 | 540 PR|INT.... |
|00005760| 20 20 20 20 42 79 20 74 | 68 65 20 77 61 79 2c 20 | By t|he way, |
|00005770| 46 4f 52 4d 41 54 20 73 | 74 61 74 65 6d 65 6e 74 |FORMAT s|tatement|
|00005780| 73 20 77 6f 72 6b 20 77 | 6f 6e 64 65 72 66 75 6c |s work w|onderful|
|00005790| 6c 79 20 77 65 6c 6c 20 | 77 69 74 68 20 73 63 72 |ly well |with scr|
|000057a0| 65 65 6e 20 6f 75 74 70 | 75 74 2c 0d 0a 20 20 20 |een outp|ut,.. |
|000057b0| 20 20 73 6f 20 64 6f 6e | 27 74 20 69 67 6e 6f 72 | so don|'t ignor|
|000057c0| 65 20 74 68 65 73 65 20 | 77 68 65 6e 20 79 6f 75 |e these |when you|
|000057d0| 20 61 72 65 20 64 6f 69 | 6e 67 20 79 6f 75 20 70 | are doi|ng you p|
|000057e0| 72 6f 67 72 61 6d 73 2e | 0d 0a 0d 0a 20 20 20 20 |rograms.|.... |
|000057f0| 20 54 68 65 20 46 4f 52 | 2f 4e 45 58 54 20 66 6c | The FOR|/NEXT fl|
|00005800| 6f 77 63 68 61 72 74 20 | 69 73 20 73 68 6f 77 6e |owchart |is shown|
|00005810| 20 62 65 6c 6f 77 3a 0d | 0a 0d 0a 0d 0a 0d 0a 0d | below:.|........|
|00005820| 0a 0d 0a 0d 0a 0d 0a 0d | 0a 0d 0a 0d 0a 0d 0a 0d |........|........|
|00005830| 0a 0d 0a 0d 0a 0d 0a 0d | 0a 20 20 20 20 20 20 20 |........|. |
|00005840| 20 20 20 20 20 20 20 20 | 20 20 1b 45 20 20 20 20 | | .E |
|00005850| 20 20 20 20 20 20 20 20 | 20 20 20 20 1b 46 20 20 | | .F |
|00005860| 20 20 20 20 20 1b 45 20 | 20 35 39 0d 0a 0d 0a 0c | .E | 59.....|
|00005870| 0d 0a 0d 0a 0d 0a 0d 0a | 1b 46 20 20 20 20 20 1b |........|.F .|
|00005880| 45 43 48 41 50 54 45 52 | 20 35 1b 46 20 20 20 20 |ECHAPTER| 5.F |
|00005890| 20 20 20 20 20 20 20 20 | 20 20 20 1b 45 49 4e 54 | | .EINT|
|000058a0| 45 52 41 43 54 49 56 45 | 20 50 52 4f 47 52 41 4d |ERACTIVE| PROGRAM|
|000058b0| 4d 49 4e 47 1b 46 20 20 | 20 20 20 20 20 20 20 20 |MING.F | |
|000058c0| 20 20 20 20 20 20 1b 45 | 43 48 41 50 54 45 52 20 | .E|CHAPTER |
|000058d0| 35 0d 0a 0d 0a 0d 0a 20 | 20 20 20 20 1b 46 49 20 |5...... | .FI |
|000058e0| 6b 6e 6f 77 20 79 6f 75 | 27 72 65 20 65 61 67 65 |know you|'re eage|
|000058f0| 72 20 74 6f 20 75 73 65 | 20 74 68 69 73 20 6e 69 |r to use| this ni|
|00005900| 66 74 79 20 6e 65 77 20 | 73 74 75 66 66 2e 20 20 |fty new |stuff. |
|00005910| 53 6f 20 64 6f 65 73 20 | 6f 75 72 20 66 72 69 65 |So does |our frie|
|00005920| 6e 64 6c 79 0d 0a 20 20 | 20 20 20 73 79 73 74 65 |ndly.. | syste|
|00005930| 6d 73 20 61 6e 61 6c 79 | 73 74 20 77 68 6f 20 6a |ms analy|st who j|
|00005940| 75 73 74 20 68 61 70 70 | 65 6e 73 20 74 6f 20 68 |ust happ|ens to h|
|00005950| 61 76 65 20 61 20 73 70 | 65 63 69 66 69 63 61 74 |ave a sp|ecificat|
|00005960| 69 6f 6e 2e 0d 0a 0d 0a | 0d 0a 20 20 20 20 20 1b |ion.....|.. .|
|00005970| 45 53 50 45 43 49 46 49 | 43 41 54 49 4f 4e 0d 0a |ESPECIFI|CATION..|
|00005980| 0d 0a 20 20 20 20 20 1b | 46 57 61 6c 74 65 72 27 |.. .|FWalter'|
|00005990| 73 20 46 6f 75 6c 20 57 | 65 61 74 68 65 72 20 53 |s Foul W|eather S|
|000059a0| 65 72 76 69 63 65 20 6e | 65 65 64 73 20 61 20 70 |ervice n|eeds a p|
|000059b0| 72 6f 67 72 61 6d 20 74 | 6f 20 64 6f 20 74 65 6d |rogram t|o do tem|
|000059c0| 70 65 72 61 74 75 72 65 | 0d 0a 20 20 20 20 20 63 |perature|.. c|
|000059d0| 6f 6e 76 65 72 73 69 6f | 6e 73 2e 20 20 57 61 6c |onversio|ns. Wal|
|000059e0| 74 65 72 2c 20 74 68 65 | 20 73 6f 6c 65 20 6f 77 |ter, the| sole ow|
|000059f0| 6e 65 72 20 61 6e 64 20 | 70 72 6f 70 72 69 65 74 |ner and |propriet|
|00005a00| 6f 72 20 6f 66 20 74 68 | 65 20 73 65 72 76 69 63 |or of th|e servic|
|00005a10| 65 2c 20 6f 6e 6c 79 0d | 0a 20 20 20 20 20 6b 6e |e, only.|. kn|
|00005a20| 6f 77 73 20 74 77 6f 20 | 63 6f 6e 76 65 72 73 69 |ows two |conversi|
|00005a30| 6f 6e 73 3b 20 30 20 64 | 65 67 72 65 65 73 20 43 |ons; 0 d|egrees C|
|00005a40| 20 69 73 20 74 68 65 20 | 73 61 6d 65 20 61 73 20 | is the |same as |
|00005a50| 33 32 20 64 65 67 72 65 | 65 73 20 46 20 61 6e 64 |32 degre|es F and|
|00005a60| 20 31 30 30 0d 0a 20 20 | 20 20 20 64 65 67 72 65 | 100.. | degre|
|00005a70| 65 73 20 43 20 69 73 20 | 74 68 65 20 73 61 6d 65 |es C is |the same|
|00005a80| 20 61 73 20 32 31 32 20 | 64 65 67 72 65 65 73 20 | as 212 |degrees |
|00005a90| 46 2e 20 20 54 68 69 73 | 20 6c 69 6d 69 74 73 20 |F. This| limits |
|00005aa0| 68 69 73 20 61 62 69 6c | 69 74 79 20 74 6f 0d 0a |his abil|ity to..|
|00005ab0| 20 20 20 20 20 70 72 6f | 76 69 64 65 20 73 65 72 | pro|vide ser|
|00005ac0| 76 69 63 65 20 74 6f 20 | 74 68 65 20 70 6f 69 6e |vice to |the poin|
|00005ad0| 74 20 77 68 65 72 65 20 | 68 65 20 69 73 20 64 79 |t where |he is dy|
|00005ae0| 69 6e 67 20 6f 66 20 73 | 74 61 72 76 61 74 69 6f |ing of s|tarvatio|
|00005af0| 6e 20 62 65 63 61 75 73 | 65 20 68 65 0d 0a 20 20 |n becaus|e he.. |
|00005b00| 20 20 20 63 61 6e 27 74 | 20 61 66 66 6f 72 64 20 | can't| afford |
|00005b10| 74 6f 20 62 75 79 20 66 | 6f 6f 64 2e 20 20 48 65 |to buy f|ood. He|
|00005b20| 20 64 6f 65 73 2c 20 68 | 6f 77 65 76 65 72 2c 20 | does, h|owever, |
|00005b30| 6f 77 6e 20 61 20 75 73 | 65 64 20 63 6f 6d 70 75 |own a us|ed compu|
|00005b40| 74 65 72 20 77 68 69 63 | 68 2c 0d 0a 20 20 20 20 |ter whic|h,.. |
|00005b50| 20 77 69 74 68 20 74 68 | 65 20 70 72 6f 70 65 72 | with th|e proper|
|00005b60| 20 70 72 6f 67 72 61 6d | 6d 69 6e 67 20 63 6f 75 | program|ming cou|
|00005b70| 6c 64 20 64 6f 20 74 68 | 65 20 6a 6f 62 2e 0d 0a |ld do th|e job...|
|00005b80| 0d 0a 20 20 20 20 20 57 | 72 69 74 65 20 61 20 70 |.. W|rite a p|
|00005b90| 72 6f 67 72 61 6d 20 74 | 68 61 74 20 70 65 72 66 |rogram t|hat perf|
|00005ba0| 6f 72 6d 73 20 74 68 65 | 20 66 6f 6c 6c 6f 77 69 |orms the| followi|
|00005bb0| 6e 67 3a 0d 0a 0d 0a 20 | 20 20 20 20 2d 20 53 74 |ng:.... | - St|
|00005bc0| 61 72 74 73 20 62 79 20 | 61 73 6b 69 6e 67 20 22 |arts by |asking "|
|00005bd0| 44 4f 20 59 4f 55 20 57 | 41 4e 54 20 54 4f 20 43 |DO YOU W|ANT TO C|
|00005be0| 4f 4e 56 45 52 54 20 57 | 41 4c 54 45 52 20 28 59 |ONVERT W|ALTER (Y|
|00005bf0| 45 53 20 4f 52 20 4e 4f | 29 3a 0d 0a 0d 0a 20 20 |ES OR NO|):.... |
|00005c00| 20 20 20 20 20 2d 20 49 | 46 46 20 74 68 65 20 61 | - I|FF the a|
|00005c10| 6e 73 77 65 72 20 69 73 | 20 79 65 73 20 74 68 65 |nswer is| yes the|
|00005c20| 6e 20 61 73 6b 20 74 68 | 65 20 71 75 65 73 74 69 |n ask th|e questi|
|00005c30| 6f 6e 20 22 49 4e 50 55 | 54 20 49 53 20 46 20 6f |on "INPU|T IS F o|
|00005c40| 72 20 43 3a 22 0d 0a 0d | 0a 20 20 20 20 20 20 20 |r C:"...|. |
|00005c50| 20 20 20 2d 20 54 68 65 | 6e 20 61 73 6b 20 22 57 | - The|n ask "W|
|00005c60| 48 41 54 20 49 53 20 54 | 48 45 20 54 45 4d 50 45 |HAT IS T|HE TEMPE|
|00005c70| 52 41 54 55 52 45 20 54 | 4f 20 42 45 20 43 4f 4e |RATURE T|O BE CON|
|00005c80| 56 45 52 54 45 44 3a 22 | 0d 0a 0d 0a 20 20 20 20 |VERTED:"|.... |
|00005c90| 20 20 20 20 20 20 20 20 | 20 2d 20 49 66 20 74 68 | | - If th|
|00005ca0| 65 20 61 6e 73 77 65 72 | 20 69 73 20 43 20 74 68 |e answer| is C th|
|00005cb0| 65 6e 20 63 6f 6e 76 65 | 72 74 20 74 6f 20 46 20 |en conve|rt to F |
|00005cc0| 62 79 20 75 73 69 6e 67 | 20 74 68 65 20 66 6f 72 |by using| the for|
|00005cd0| 6d 75 6c 61 0d 0a 20 20 | 20 20 20 20 20 20 20 20 |mula.. | |
|00005ce0| 20 20 20 20 20 46 20 3d | 20 39 43 2f 35 20 2b 20 | F =| 9C/5 + |
|00005cf0| 33 32 0d 0a 0d 0a 20 20 | 20 20 20 20 20 20 20 20 |32.... | |
|00005d00| 20 20 20 20 20 45 6c 73 | 65 20 74 68 65 20 61 6e | Els|e the an|
|00005d10| 73 77 65 72 20 6d 75 73 | 74 20 62 65 20 46 20 69 |swer mus|t be F i|
|00005d20| 6e 20 77 68 69 63 68 20 | 63 61 73 65 20 79 6f 75 |n which |case you|
|00005d30| 20 75 73 65 20 74 68 65 | 20 66 6f 72 6d 75 6c 61 | use the| formula|
|00005d40| 0d 0a 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |.. | |
|00005d50| 20 43 20 3d 20 35 2f 39 | 28 46 2d 33 32 29 0d 0a | C = 5/9|(F-32)..|
|00005d60| 0d 0a 20 20 20 20 20 20 | 20 20 20 20 2d 20 44 69 |.. | - Di|
|00005d70| 73 70 6c 61 79 20 74 68 | 65 20 63 6f 6e 76 65 72 |splay th|e conver|
|00005d80| 74 65 64 20 61 6e 73 77 | 65 72 20 61 6e 64 20 61 |ted answ|er and a|
|00005d90| 73 6b 20 69 66 20 68 65 | 20 77 61 6e 74 73 20 74 |sk if he| wants t|
|00005da0| 6f 20 63 6f 6e 76 65 72 | 74 20 61 67 61 69 6e 0d |o conver|t again.|
|00005db0| 0a 0d 0a 20 20 20 20 20 | 20 20 20 20 20 2d 20 41 |... | - A|
|00005dc0| 20 6e 6f 20 61 6e 73 77 | 65 72 20 74 6f 20 63 6f | no answ|er to co|
|00005dd0| 6e 76 65 72 73 69 6f 6e | 20 6d 75 73 74 20 63 61 |nversion| must ca|
|00005de0| 75 73 65 20 74 68 65 20 | 70 72 6f 67 72 61 6d 20 |use the |program |
|00005df0| 74 6f 20 74 65 72 6d 69 | 6e 61 74 65 2e 0d 0a 0d |to termi|nate....|
|00005e00| 0a 20 20 20 20 20 2d 20 | 54 68 65 20 66 6f 6c 6c |. - |The foll|
|00005e10| 6f 77 69 6e 67 20 65 72 | 72 6f 72 20 63 68 65 63 |owing er|ror chec|
|00005e20| 6b 73 20 6e 65 65 64 20 | 74 6f 20 62 65 20 69 6e |ks need |to be in|
|00005e30| 20 79 6f 75 72 20 70 72 | 6f 67 72 61 6d 3a 0d 0a | your pr|ogram:..|
|00005e40| 0d 0a 20 20 20 20 20 20 | 20 43 6f 6e 76 65 72 73 |.. | Convers|
|00005e50| 69 6f 6e 20 20 20 2d 20 | 20 20 6d 75 73 74 20 62 |ion - | must b|
|00005e60| 65 20 65 69 74 68 65 72 | 20 22 79 65 73 22 20 6f |e either| "yes" o|
|00005e70| 72 20 22 6e 6f 22 0d 0a | 20 20 20 20 20 20 20 49 |r "no"..| I|
|00005e80| 6e 70 75 74 20 20 20 20 | 20 20 20 20 2d 20 20 20 |nput | - |
|00005e90| 6d 75 73 74 20 62 65 20 | 65 69 74 68 65 72 20 22 |must be |either "|
|00005ea0| 46 22 20 6f 72 20 22 43 | 22 0d 0a 20 20 20 20 20 |F" or "C|".. |
|00005eb0| 20 20 54 65 6d 70 65 72 | 61 74 75 72 65 20 20 2d | Temper|ature -|
|00005ec0| 20 20 20 6d 75 73 74 20 | 62 65 20 3e 20 2d 35 30 | must |be > -50|
|00005ed0| 20 61 6e 64 20 3c 20 31 | 32 30 20 66 6f 72 20 65 | and < 1|20 for e|
|00005ee0| 69 74 68 65 72 20 46 20 | 6f 72 20 43 0d 0a 0d 0a |ither F |or C....|
|00005ef0| 0d 0a 20 20 20 20 20 52 | 65 6d 65 6d 62 65 72 2c |.. R|emember,|
|00005f00| 20 74 68 69 73 20 70 72 | 6f 67 72 61 6d 20 69 73 | this pr|ogram is|
|00005f10| 20 73 6f 20 68 6f 74 20 | 74 68 61 74 20 69 74 27 | so hot |that it'|
|00005f20| 73 20 6f 66 66 20 57 61 | 6c 74 65 72 27 73 20 73 |s off Wa|lter's s|
|00005f30| 63 61 6c 65 20 6f 66 0d | 0a 20 20 20 20 20 61 63 |cale of.|. ac|
|00005f40| 63 65 70 74 61 62 6c 65 | 20 74 65 6d 70 65 72 61 |ceptable| tempera|
|00005f50| 74 75 72 65 20 72 65 61 | 64 69 6e 67 73 2e 0d 0a |ture rea|dings...|
|00005f60| 0d 0a 0d 0a 20 20 20 20 | 20 1b 45 41 4e 4f 54 48 |.... | .EANOTH|
|00005f70| 45 52 20 53 50 45 43 49 | 46 49 43 41 54 49 4f 4e |ER SPECI|FICATION|
|00005f80| 0d 0a 0d 0a 20 20 20 20 | 20 1b 46 48 65 72 65 27 |.... | .FHere'|
|00005f90| 73 20 74 68 65 20 6e 65 | 78 74 20 70 65 72 73 6f |s the ne|xt perso|
|00005fa0| 6e 20 77 69 74 68 20 61 | 20 70 72 6f 62 6c 65 6d |n with a| problem|
|00005fb0| 3a 0d 0a 0d 0a 20 20 20 | 20 20 53 76 65 6e 20 53 |:.... | Sven S|
|00005fc0| 76 65 6e 73 6f 6e 27 73 | 2c 20 79 6f 75 72 20 66 |venson's|, your f|
|00005fd0| 61 76 6f 72 69 74 65 20 | 49 74 61 6c 69 61 6e 20 |avorite |Italian |
|00005fe0| 72 65 73 74 61 75 72 61 | 6e 74 20 69 73 20 63 6f |restaura|nt is co|
|00005ff0| 6d 70 75 74 65 72 69 7a | 69 6e 67 20 69 74 73 0d |mputeriz|ing its.|
|00006000| 0a 20 20 20 20 20 74 61 | 6b 65 6f 75 74 20 64 65 |. ta|keout de|
|00006010| 70 61 72 74 6d 65 6e 74 | 2e 20 20 59 6f 75 20 61 |partment|. You a|
|00006020| 67 72 65 65 64 20 74 6f | 20 64 6f 20 74 68 65 20 |greed to| do the |
|00006030| 70 72 6f 67 72 61 6d 6d | 69 6e 67 20 69 6e 20 65 |programm|ing in e|
|00006040| 78 63 68 61 6e 67 65 20 | 66 6f 72 20 61 0d 0a 20 |xchange |for a.. |
|00006050| 20 20 20 20 6c 69 66 65 | 74 69 6d 65 20 73 75 70 | life|time sup|
|00006060| 70 6c 79 20 6f 66 20 61 | 6e 63 68 6f 76 79 20 70 |ply of a|nchovy p|
|00006070| 69 7a 7a 61 73 2e 20 20 | 54 68 65 20 63 6f 6e 74 |izzas. |The cont|
|00006080| 72 61 63 74 20 63 61 6c | 6c 73 20 66 6f 72 20 61 |ract cal|ls for a|
|00006090| 20 73 74 72 75 63 74 75 | 72 65 64 0d 0a 20 20 20 | structu|red.. |
|000060a0| 20 20 42 41 53 49 43 20 | 70 72 6f 67 72 61 6d 20 | BASIC |program |
|000060b0| 28 6e 6f 20 73 70 61 67 | 68 65 74 74 69 20 63 6f |(no spag|hetti co|
|000060c0| 64 65 20 61 6c 6c 6f 77 | 65 64 29 20 74 68 61 74 |de allow|ed) that|
|000060d0| 20 77 69 6c 6c 20 72 75 | 6e 20 6f 6e 20 74 68 65 | will ru|n on the|
|000060e0| 69 72 0d 0a 0d 0a 0d 0a | 0d 0a 20 20 20 20 20 20 |ir......|.. |
|000060f0| 20 20 20 20 20 20 20 20 | 20 20 20 1b 45 20 20 20 | | .E |
|00006100| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 1b 46 20 | | .F |
|00006110| 20 20 20 20 20 20 1b 45 | 20 20 36 30 0d 0a 0d 0a | .E| 60....|
|00006120| 0c 0d 0a 0d 0a 0d 0a 0d | 0a 1b 46 20 20 20 20 20 |........|..F |
|00006130| 1b 45 43 48 41 50 54 45 | 52 20 35 1b 46 20 20 20 |.ECHAPTE|R 5.F |
|00006140| 20 20 20 20 20 20 20 20 | 20 20 20 20 1b 45 49 4e | | .EIN|
|00006150| 54 45 52 41 43 54 49 56 | 45 20 50 52 4f 47 52 41 |TERACTIV|E PROGRA|
|00006160| 4d 4d 49 4e 47 1b 46 20 | 20 20 20 20 20 20 20 20 |MMING.F | |
|00006170| 20 20 20 20 20 20 20 1b | 45 43 48 41 50 54 45 52 | .|ECHAPTER|
|00006180| 20 35 0d 0a 0d 0a 0d 0a | 20 20 20 20 20 1b 46 4d | 5......| .FM|
|00006190| 65 61 74 62 61 6c 6c 20 | 49 56 20 6d 61 69 6e 66 |eatball |IV mainf|
|000061a0| 72 61 6d 65 20 61 6e 64 | 20 74 61 6b 65 20 6f 72 |rame and| take or|
|000061b0| 64 65 72 73 20 66 6f 72 | 20 70 69 7a 7a 61 73 2e |ders for| pizzas.|
|000061c0| 20 20 54 77 6f 20 6f 70 | 74 69 6f 6e 73 20 61 72 | Two op|tions ar|
|000061d0| 65 0d 0a 20 20 20 20 20 | 61 76 61 69 6c 61 62 6c |e.. |availabl|
|000061e0| 65 2c 20 63 68 65 65 73 | 65 20 61 6e 64 20 61 6e |e, chees|e and an|
|000061f0| 63 68 6f 76 79 2e 20 20 | 59 6f 75 72 20 70 72 6f |chovy. |Your pro|
|00006200| 67 72 61 6d 20 69 73 20 | 74 6f 20 70 65 72 66 6f |gram is |to perfo|
|00006210| 72 6d 20 74 68 65 0d 0a | 20 20 20 20 20 66 6f 6c |rm the..| fol|
|00006220| 6c 6f 77 69 6e 67 3a 0d | 0a 0d 0a 20 20 20 20 20 |lowing:.|... |
|00006230| 2d 20 46 69 72 73 74 20 | 69 74 20 61 73 6b 73 20 |- First |it asks |
|00006240| 22 44 4f 20 59 4f 55 20 | 57 41 4e 54 20 41 20 50 |"DO YOU |WANT A P|
|00006250| 49 5a 5a 41 20 51 55 4f | 54 41 54 49 4f 4e 20 28 |IZZA QUO|TATION (|
|00006260| 59 45 53 20 4f 52 20 4e | 4f 29 3a 20 22 0d 0a 0d |YES OR N|O): "...|
|00006270| 0a 20 20 20 20 20 20 20 | 2d 20 49 66 20 74 68 65 |. |- If the|
|00006280| 20 61 6e 73 77 65 72 20 | 69 73 20 4e 4f 20 74 68 | answer |is NO th|
|00006290| 65 6e 20 79 6f 75 20 74 | 65 72 6d 69 6e 61 74 65 |en you t|erminate|
|000062a0| 2e 0d 0a 20 20 20 20 20 | 20 20 2d 20 49 66 20 74 |... | - If t|
|000062b0| 68 65 20 61 6e 73 77 65 | 72 20 69 73 20 59 45 53 |he answe|r is YES|
|000062c0| 20 74 68 65 6e 20 79 6f | 75 20 63 6f 6e 74 69 6e | then yo|u contin|
|000062d0| 75 65 2e 0d 0a 0d 0a 20 | 20 20 20 20 20 20 20 20 |ue..... | |
|000062e0| 2d 20 4e 65 78 74 20 61 | 73 6b 20 22 45 4e 54 45 |- Next a|sk "ENTE|
|000062f0| 52 20 27 43 48 27 20 46 | 4f 52 20 43 48 45 45 53 |R 'CH' F|OR CHEES|
|00006300| 45 20 4f 52 20 27 41 4e | 27 20 46 4f 52 20 41 4e |E OR 'AN|' FOR AN|
|00006310| 43 48 4f 56 59 3a 20 22 | 0d 0a 20 20 20 20 20 20 |CHOVY: "|.. |
|00006320| 20 20 20 20 20 2d 20 49 | 66 20 74 68 65 20 61 6e | - I|f the an|
|00006330| 73 77 65 72 20 69 73 20 | 43 48 20 74 68 65 6e 20 |swer is |CH then |
|00006340| 74 68 65 20 63 6f 73 74 | 20 70 65 72 20 70 69 7a |the cost| per piz|
|00006350| 7a 61 20 69 73 20 24 31 | 2e 37 35 2e 0d 0a 20 20 |za is $1|.75... |
|00006360| 20 20 20 20 20 20 20 20 | 20 20 20 65 6c 73 65 20 | | else |
|00006370| 74 68 65 20 61 6e 73 77 | 65 72 20 69 73 20 41 4e |the answ|er is AN|
|00006380| 20 74 68 65 6e 20 74 68 | 65 20 63 6f 73 74 20 70 | then th|e cost p|
|00006390| 65 72 20 70 69 7a 7a 61 | 20 69 73 20 24 33 2e 32 |er pizza| is $3.2|
|000063a0| 30 2e 0d 0a 20 20 20 20 | 20 20 20 20 20 20 20 2d |0... | -|
|000063b0| 20 46 69 6e 61 6c 6c 79 | 20 61 73 6b 73 20 22 48 | Finally| asks "H|
|000063c0| 4f 57 20 4d 41 4e 59 20 | 50 49 5a 5a 41 53 20 3f |OW MANY |PIZZAS ?|
|000063d0| 20 22 20 61 6e 64 20 70 | 72 6f 64 75 63 65 73 20 | " and p|roduces |
|000063e0| 61 20 74 61 62 6c 65 20 | 6f 66 0d 0a 20 20 20 20 |a table |of.. |
|000063f0| 20 20 20 20 20 20 20 20 | 20 6f 66 20 63 6f 73 74 | | of cost|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.