home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / cpm / basic / basictut.ark / TUTR.01 < prev    next >
Encoding:
Text File  |  1985-02-10  |  8.5 KB  |  215 lines

  1. 3000    rem   TUTR.01         Ver 2.0   01AUG83
  2. 3010    let q=0
  3. 3020    let r=0
  4. 3030    print cls$;fnposcur$(4,1)
  5. 3040    print "Welcome to KAYPRO Education. I am going to try to"
  6. 3050    print "teach you enough about CP/M and about MBASIC in the next"
  7. 3060    print "few lessons to enable you to write your own computer programs."
  8. 3070      print : print "Hit any key to continue: "
  9. 3080    gosub 40800
  10. 3090    print cls$;fnposcur$(4,1);
  11. 3100       print "Before we can write a program, we need to review the symbols"
  12. 3110       print "available:"
  13. 3120       print 
  14. 3130       print "  (1) +"
  15. 3140       print "  (2)  -"
  16. 3150       print "  (3)   /"
  17. 3160       print "  (4)    *"
  18. 3170       print "  (5)    ( )       "
  19. 3180       print "  (6)      ^"
  20. 3190       print 
  21. 3200       print "After the ? below, type the number of your answer."
  22. 3210       print 
  23. 3220       print fnposcur$(20,1);elr$;"Which of the above symbols is used for addition? ";
  24. 3230       let q=q+1
  25. 3240       input c
  26. 3250       if c=1 then 3370
  27. 3260       if c=2 then 3350
  28. 3270       if c=3 then 3330
  29. 3280       if c>3 then 3310
  30. 3290       print fnposcur$(18,1);elr$;"Type the NUMBER of your answer, not the SYMBOL."
  31. 3300    goto 3220
  32. 3310    print fnposcur$(18,1);elr$;"Sorry, guess again."
  33. 3320   goto 3220
  34. 3330   print fnposcur$(18,1);elr$;"No. once again..."
  35. 3340   goto 3220
  36. 3350   print fnposcur$(18,1);elr$;"You don't mean that."
  37. 3360   goto 3220
  38. 3370   print  fnposcur$(18,1);elr$"Good."
  39. 3380   let r=r+1
  40. 3390   print fnposcur$(20,1);elr$;"Which symbol is used for subtraction";
  41. 3400   input d
  42. 3410   let q=q+1
  43. 3420   if d>3 then 3480
  44. 3430   if d=3 then 3530
  45. 3440   if d=2 then 3500
  46. 3450   if d<=0 then 3480
  47. 3460   print fnposcur$(18,1);elr$"Come on now; you just told me that one was for addition. so..."
  48. 3470   goto 3390
  49. 3480   print fnposcur$(18,1);elr$;"Please guess again."
  50. 3490   goto 3390
  51. 3500   print fnposcur$(18,1);elr$;"Right"
  52. 3510   let r=r+1
  53. 3520   goto 3550
  54. 3530   print fnposcur$(18,1);elr$"You can't be serious."
  55. 3540   goto 3480
  56. 3550   print fnposcur$(20,1);elr$;"Which symbol is used for division";
  57. 3560   input e
  58. 3570   let q=q+1
  59. 3580   if e=3 then 3650
  60. 3590   if e>3 then 3630
  61. 3600   if e<=0 then 3630
  62. 3610   print fnposcur$(18,1);elr$;"You must not have been looking at which key you hit ";
  63. 3620   goto 3550
  64. 3630   print fnposcur$(18,1);elr$;"Try again."
  65. 3640   goto 3550
  66. 3650   print fnposcur$(18,1);elr$;"Good for you. Now the next one is tricky:"
  67. 3660   let r=r+1
  68. 3670   print fnposcur$(20,1);elr$;"Which symbol is used for multiplication";
  69. 3680   input f
  70. 3690   let q=q+1
  71. 3700   if f=1 then 3220
  72. 3710   if f=2 then 3350
  73. 3720   if f=3 then 3530
  74. 3730   if f=4 then 3790
  75. 3740   if f=5 then 3770
  76. 3750   if f=6 then 3770
  77. 3760   goto 3670
  78. 3770   print fnposcur$(18,1);elr$;"No. This will be explained later. Again, "
  79. 3780   goto 3670
  80. 3790   print fnposcur$(18,1);elr$;"Very good! "
  81. 3800   print elr$;"If 'X' were used for multiply, it might be confused with the variable X. "
  82. 3810   print elr$:print elr$;"Now, hit any key to practice a little:"
  83. 3820   gosub 40800
  84. 3830   print cls$;fnposcur$(10,1)
  85. 3840   let r=r+1
  86. 3850   print "How much is 2*3";
  87. 3860   input g
  88. 3870   let q=q+1
  89. 3880   if g=6 then 3910
  90. 3890   print els$;"No. Remember, * means multiply."
  91. 3900   goto 3850
  92. 3910   print els$;"Sure"
  93. 3920   print "Hit any key to continue: "
  94. 3930   gosub 40800
  95. 3940   print cls$;fnposcur$(10,1)
  96. 3950   let r=r+1
  97. 3960   print "How much is 3*4+7 ";
  98. 3970   input h
  99. 3980   let q=q+1
  100. 3990   if h=19 then 4050
  101. 4000   if h=33 then 4030
  102. 4010   print els$;"Sorry, look again"
  103. 4020   goto 3960
  104. 4030   print els$;"No: Multiplications always precede additions."
  105. 4040   goto 3960
  106. 4050   print els$;"Right you are."
  107. 4060   print "Hit any key to continue: "
  108. 4070   gosub 40800
  109. 4080   print cls$;fnposcur$(10,1)
  110. 4090   let r=r+1
  111. 4100   print "How much is 3*(1+5)/2 ";
  112. 4110   input i
  113. 4120   let q=q+1
  114. 4130   if i=9 then 4160
  115. 4140   print els$;"No: operations within () precede others."
  116. 4150   goto 4100
  117. 4160   print els$;"Good"
  118. 4170   print "Hit any key to continue: "
  119. 4180   gosub 40800
  120. 4190   let r=r+1
  121. 4200   print cls$
  122. 4210   print "That leaves ^ which is our way to indicate squares, cubes, etc."
  123. 4220   print "Such as X^2 for 'X SQUARED' or X*X, Y^3 for Y*Y*Y, etc."
  124. 4230   print "We also can use functions such as sine, cosine, etc., and"
  125. 4240   print "you can even define your own, but these will be covered in"
  126. 4250   print "another lesson.  
  127. 4260      print : print "Hit any key to continue: "
  128. 4270    gosub 40800
  129. 4280    print cls$;fnposcur$(4,1);
  130. 4290   print "We'll use SQR (square root) in our coming"
  131. 4300   print "example to give you the idea. Let's assume you want to compose"
  132. 4310   print "a program to compute radius vectors (the square root of the"
  133. 4320   print "sum of the squares of three components.)  This program will"
  134. 4330   print "be a sequence of statements to tell the computer what to do."
  135. 4340   print "How do you think these statements should be numbered?"
  136. 4350   print " (1) consecutively (1, 2, 3, etc. )"
  137. 4360   print " (2) incrementally (10, 20, 30, etc.)"
  138. 4370   print " (3) any sequence, it doesn't matter"
  139. 4380   print "(Type no. of answer)"
  140. 4390   input j
  141. 4400   let q=q+1
  142. 4410   if j=1 then 4470 else if j=2 then 4450
  143. 4420   print "The computer needs to have the numbers of the statements"
  144. 4430   print "in sequential order when it runs your program. Remember, too,"
  145. 4440   goto 4460
  146. 4450   print "Right."
  147. 4460   let r=r+1
  148. 4470   print "Leaving space between numbers permits easier insertions, later"
  149. 4480      print : print "Hit any key to continue: "
  150. 4490    gosub 40800
  151. 4500    print cls$;fnposcur$(4,1);
  152. 4510   print "For our sample program, let's first call for our known "
  153. 4520   print "variables.  We simply type:"
  154. 4530   print 
  155. 4540   print "10 INPUT X, Y, Z"
  156. 4550   print 
  157. 4560   print "10 is simply the first statement number.  The word"
  158. 4570   print "'INPUT' tells the computer to accept the following"
  159. 4580   print "data from the user terminal.  X, Y, and Z are our"
  160. 4590   print "'DATA'. 
  161. 4600      print : print "Hit any key to continue: "
  162. 4610    gosub 40800
  163. 4620    print cls$;fnposcur$(4,1);
  164. 4630   print "Next, we write our equation by typing:"
  165. 4640   print 
  166. 4650   print "20 LET R = SQR (X^2 + Y^2 + Z^2)"
  167. 4660   print 
  168. 4670   print "where 20 is the next statement number, 'LET' tells the computer"
  169. 4680   print "that an equation is coming, and 'R' is our unknown variable."
  170. 4690   print "Note: unknowns must be to the left of the '=' and knowns are"
  171. 4700   print "on the right. SQR is the square root function mentioned"
  172. 4710   print "earlier. The rest is algebra the way it has to be typed on the keyboard"
  173. 4720      print : print "Hit any key to continue: "
  174. 4730    gosub 40800
  175. 4740    print cls$;fnposcur$(4,1);
  176. 4750   print "From this point on, 'R' can be treated as a "
  177. 4760   print "'KNOWN' in other equations (in the same program).
  178. 4770   print "In this example, we'll tell the computer to print 
  179. 4780   print "the value of 'R' by typing the statement:"
  180. 4790   print 
  181. 4800   print "30 PRINT  R"
  182. 4810   print 
  183. 4820   print "WHich will cause the computer to do just that."
  184. 4830      print : print "Hit any key to continue: "
  185. 4840    gosub 40800
  186. 4850    print cls$;fnposcur$(4,1);
  187. 4860   print "We now add an 'END' statement and this is our complete program:"
  188. 4870   print 
  189. 4880   print "10 INPUT X, Y, Z"
  190. 4890   print "20 LET R = SQR (X^2 + Y^2 + Z^2)"
  191. 4900   print "30 PRINT  R"
  192. 4910   print "40 END"
  193. 4920   print 
  194. 4930   print "When 'RUN' is typed, the program will call for the values of"
  195. 4940   print "X, Y, and Z with a question mark (?)."
  196. 4950      print : print "Hit any key to continue: "
  197. 4960    gosub 40800
  198. 4970    print cls$;fnposcur$(4,1);
  199. 4980   print "        (Try it: type any 3 numbers, separated by commas:)"
  200. 4990   input x, y, z
  201. 5000   print sqr(x^2+y^2+z^2);"  (This is your 'R', or RADIUS VECTOR.)"
  202. 5010      print : print "Hit any key to continue: "
  203. 5020    gosub 40800
  204. 5030    print cls$;fnposcur$(4,1);
  205. 5040   print "Well, the hard part is over and now the fun begins. By the"
  206. 5050   print "way, you have answered";R;" correctly out of";Q;"questions."
  207. 5060   print "In order to continue what we have begun, you should"
  208. 5070   print "request the next lesson in the sequence from me. To do this,"
  209. 5080   print "return to the menu and ask for 'TUTR02'. "
  210. 5090   print "I'll meet you there.  LAST ONE THERE IS A HUMAN!  "
  211. 5100   print "Hit any key to return to the menu: "
  212. 5110   gosub 40800
  213. 5120   RUN "MENU"
  214. 5130   end
  215.