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

  1. 3000    'TUTR.03         Ver 2.0   01AUG83
  2. 3010 QUOTE$ = CHR$(34)
  3. 3020    PRINT CLS$;FNPOSCUR$(10,1);
  4. 3030    PRINT "Hi. Good to see you again. I'm assuming you have been through"
  5. 3040    PRINT "'TUTR01' and 'TUTR02'.  You HAVE, haven't you? (yes or no)";
  6. 3050    INPUT A$
  7. 3060     CVTSTR$ = A$:GOSUB 40600:A$ = CVTSTR$
  8. 3070    PRINT
  9. 3080    IF LEFT$(A$,1) = "Y" THEN 3230
  10. 3090    IF LEFT$(A$,1) = "N" THEN 3120
  11. 3100    GOSUB 4310
  12. 3110    GOTO 3050
  13. 3120    PRINT "This may present some difficulties, since 'TUTR01' and 'TUTR02'"
  14. 3130    PRINT "should precede this lesson. Wouldn't you rather go back and try"
  15. 3140    PRINT "them first or should we continue (0 = go back, 1 = continue)";
  16. 3150    INPUT B
  17. 3160     CVTSTR$ = A$:GOSUB 40600:A$ = CVTSTR$
  18. 3170    PRINT
  19. 3180    IF B = 0 THEN 3210
  20. 3190    IF B = 1 THEN 3230
  21. 3200    GOTO 3150
  22. 3210    PRINT CLS$;FNPOSCUR$(10,1);"OK, then.  I'm going to go back to the MENU"
  23. 3220    GOTO 4340
  24. 3230    PRINT CLS$;FNPOSCUR$(10,1);"Then let's review the example program used in 'TUTR01':"
  25. 3240    PRINT
  26. 3250    PRINT "      9 PRINT "QUOTE$"What are your values of X, Y, and Z?"QUOTE$";"
  27. 3260    PRINT "     10 INPUT X,Y,Z"
  28. 3270    PRINT "     20 LET R = SQR(X^2 + Y^2 + Z^2)"
  29. 3280    PRINT "     30 PRINT "QUOTE$"The radius vector equals"QUOTE$";R"
  30. 3290    PRINT "     35 GOTO 9"
  31. 3300    PRINT "     40 END"
  32. 3310    PRINT
  33. 3320    PRINT "This is now a complete program and shows you how to use some"
  34. 3330    PRINT "of the 'BASIC' language statements.  By the way, did you get"
  35. 3340    PRINT "a chance to write a program of your own (yes or no)";
  36. 3350    INPUT C$
  37. 3360     CVTSTR$ = C$:GOSUB 40600:C$ = CVTSTR$
  38. 3370    PRINT
  39. 3380    IF LEFT$(C$,1) = "N" THEN 3420
  40. 3390    IF LEFT$(C$,1) = "Y" THEN 3470
  41. 3400    GOSUB 4330
  42. 3410    GOTO 3350
  43. 3420    PRINT CLS$;FNPOSCUR$(10,1);"That's too bad -- It helps you to learn if you"
  44. 3430    PRINT "practice with a problem that is familiar to you."
  45. 3440    PRINT "But, we'll get going here and you can try something on your"
  46. 3450    PRINT "own after this lesson."
  47. 3460    GOTO 3510
  48. 3470    PRINT CLS$;FNPOSCUR$(10,1);"That's great.  I hope you were sucessfull in working out any"
  49. 3480    PRINT "problems that arose.  Actually, practice in writing programs"
  50. 3490    PRINT "that solve some of your problems is the best way for you to"
  51. 3500    PRINT "get familiar with a computer and its language."
  52. 3510    PRINT
  53. 3520    PRINT "Now, let's take a look at some of the statements we've used."
  54. 3530    PRINT "For example, we used 'X', 'Y', and 'Z' as our known variables"
  55. 3540    PRINT "and 'R' as our unknown variable. In the 'LET' statement, the"
  56. 3550    PRINT "unknown (R) was 'SET EQUAL TO' the knowns in an expression."
  57. 3560    PRINT "Thus, we understand 'EQUATION' to mean:"
  58. 3570    PRINT
  59. 3580    PRINT "    'Do the computations on the right hand side of the ' = '"
  60. 3590    PRINT "      sign and let the variable on the left represent the"
  61. 3600    PRINT "      value after the computation is performed.'"
  62. 3610    GOSUB 4400
  63. 3620    PRINT "You can see that this is not an 'ALGEBRAIC' equation because"
  64. 3630    PRINT "we can type a statement like:"
  65. 3640    PRINT
  66. 3650    PRINT "     25 LET V = V + 1"
  67. 3660    PRINT
  68. 3670    PRINT "This statement simply means:"
  69. 3680    PRINT
  70. 3690    PRINT "       Take the present value of 'V' and add 1 to it."
  71. 3700    GOSUB 4400
  72. 3710    PRINT "There are some things you should take note of:"
  73. 3720    PRINT
  74. 3730     PRINT "       Variables may be of any length, starting with a letter, and"
  75. 3740     PRINT "       may be mixed letters and numbers.  There are certain words"
  76. 3750     PRINT "       you may not use, though.  These are called 'RESERVED' words."
  77. 3760    PRINT "    You will find a list of RESERVED words in the MBASIC manual."
  78. 3770    PRINT "    Now will be a good time to review these words." 
  79. 3780    GOSUB 4400
  80. 3790    PRINT "Let's try a few examples and you tell me which ones are wrong."
  81. 3800    PRINT
  82. 3810    PRINT "     (1)  LET DIM = R*B^2"
  83. 3820    PRINT "                                      (Type the number of"
  84. 3830    PRINT "     (2)  LET XY = A1 + B*3              the example and the"
  85. 3840    PRINT "                                       carriage return key)"
  86. 3850    PRINT "     (3)  LET X9 = X^2 + Y^3"
  87. 3860    PRINT
  88. 3870    PRINT "Which one is wrong";
  89. 3880    INPUT C
  90. 3890    PRINT
  91. 3900    IF C = 1 THEN 3990
  92. 3910    IF C = 2 THEN 3950
  93. 3920    IF C = 3 THEN 3970
  94. 3930    PRINT "Try again and use 1, 2, or 3 for your answer. Which is wrong?";
  95. 3940    GOTO 3880
  96. 3950    PRINT "No, this is a valid statement - Try again. Which is wrong?";
  97. 3960    GOTO 3880
  98. 3970    PRINT "Not quite - this statement is legal. Try again; Which is wrong?";
  99. 3980    GOTO 3880
  100. 3990    PRINT CLS$;FNPOSCUR$(10,1);"Right! 'DIM' is a RESERVED word.  Note, though, that RESERVED"
  101. 4000    PRINT "words can be imbedded in other words: 'DIMM' would be legal."
  102. 4010    PRINT
  103. 4020    PRINT "     (1)  LET X1 = X1 + Z^5"
  104. 4030    PRINT "                                      (Type the number of"
  105. 4040    PRINT "     (2)  LET T2 = P + Q                 your choice and re-"
  106. 4050    PRINT "                                       turn the carriage)"
  107. 4060    PRINT "     (3)  LET Y = DATA + 1"
  108. 4070    PRINT
  109. 4080    PRINT "Which one is wrong this time?";
  110. 4090    INPUT C
  111. 4100    PRINT
  112. 4110    IF C = 3 THEN 4200
  113. 4120    IF C = 2 THEN 4180
  114. 4130    IF C = 1 THEN 4160
  115. 4140    PRINT "Please -- Type the number 1, 2, or 3.  Which ";
  116. 4150    GOTO 4090
  117. 4160    PRINT "No, this is valid - X1 would be incremented by 'Z^5'. Again....";
  118. 4170    GOTO 4090
  119. 4180    PRINT "This one is OK - Look a little closer. It should be....";
  120. 4190    GOTO 4090
  121. 4200    PRINT CLS$;FNPOSCUR$(10,1);"That's good. 'DATA' is illegal - You can't have a reserved word"
  122. 4210    PRINT "on either side of the equation."
  123. 4220    PRINT
  124. 4230      PRINT "So far the following kinds of statements have been used:"
  125. 4240    PRINT "'    PRINT', 'INPUT', 'LET', 'GOTO', and 'END'. If you are at "
  126. 4250    PRINT "all uncertain as to how any of these are used, look once more"
  127. 4260    PRINT "at the previous sample problem. When you are positive you"
  128. 4270    PRINT "understand, switch to the program called 'TUTR04' to continue"
  129. 4280    PRINT "this lesson.  I'll go back to the main menu and be ready to continue"
  130. 4290    PRINT "when you choose 'TUTR04'.  "
  131. 4300      GOSUB 4400 ' return
  132. 4302 RUN "MENU
  133. 4310    PRINT "Not a valid choice. Try again. Which is it? ";
  134. 4330    RETURN
  135. 4400    'Here we print a message and wait abit
  136. 4410      PRINT FNPOSCUR$(24,1);"Hit any key to continue ... ";
  137. 4420      GOSUB 40800
  138. 4430      PRINT CLS$;FNPOSCUR$(10,1);
  139. 4440      RETURN
  140. POSCUR$(24,1);"Hit an