home *** CD-ROM | disk | FTP | other *** search
- 3000 rem TUTR.01 Ver 2.0 01AUG83
- 3010 let q=0
- 3020 let r=0
- 3030 print cls$;fnposcur$(4,1)
- 3040 print "Welcome to KAYPRO Education. I am going to try to"
- 3050 print "teach you enough about CP/M and about MBASIC in the next"
- 3060 print "few lessons to enable you to write your own computer programs."
- 3070 print : print "Hit any key to continue: "
- 3080 gosub 40800
- 3090 print cls$;fnposcur$(4,1);
- 3100 print "Before we can write a program, we need to review the symbols"
- 3110 print "available:"
- 3120 print
- 3130 print " (1) +"
- 3140 print " (2) -"
- 3150 print " (3) /"
- 3160 print " (4) *"
- 3170 print " (5) ( ) "
- 3180 print " (6) ^"
- 3190 print
- 3200 print "After the ? below, type the number of your answer."
- 3210 print
- 3220 print fnposcur$(20,1);elr$;"Which of the above symbols is used for addition? ";
- 3230 let q=q+1
- 3240 input c
- 3250 if c=1 then 3370
- 3260 if c=2 then 3350
- 3270 if c=3 then 3330
- 3280 if c>3 then 3310
- 3290 print fnposcur$(18,1);elr$;"Type the NUMBER of your answer, not the SYMBOL."
- 3300 goto 3220
- 3310 print fnposcur$(18,1);elr$;"Sorry, guess again."
- 3320 goto 3220
- 3330 print fnposcur$(18,1);elr$;"No. once again..."
- 3340 goto 3220
- 3350 print fnposcur$(18,1);elr$;"You don't mean that."
- 3360 goto 3220
- 3370 print fnposcur$(18,1);elr$"Good."
- 3380 let r=r+1
- 3390 print fnposcur$(20,1);elr$;"Which symbol is used for subtraction";
- 3400 input d
- 3410 let q=q+1
- 3420 if d>3 then 3480
- 3430 if d=3 then 3530
- 3440 if d=2 then 3500
- 3450 if d<=0 then 3480
- 3460 print fnposcur$(18,1);elr$"Come on now; you just told me that one was for addition. so..."
- 3470 goto 3390
- 3480 print fnposcur$(18,1);elr$;"Please guess again."
- 3490 goto 3390
- 3500 print fnposcur$(18,1);elr$;"Right"
- 3510 let r=r+1
- 3520 goto 3550
- 3530 print fnposcur$(18,1);elr$"You can't be serious."
- 3540 goto 3480
- 3550 print fnposcur$(20,1);elr$;"Which symbol is used for division";
- 3560 input e
- 3570 let q=q+1
- 3580 if e=3 then 3650
- 3590 if e>3 then 3630
- 3600 if e<=0 then 3630
- 3610 print fnposcur$(18,1);elr$;"You must not have been looking at which key you hit ";
- 3620 goto 3550
- 3630 print fnposcur$(18,1);elr$;"Try again."
- 3640 goto 3550
- 3650 print fnposcur$(18,1);elr$;"Good for you. Now the next one is tricky:"
- 3660 let r=r+1
- 3670 print fnposcur$(20,1);elr$;"Which symbol is used for multiplication";
- 3680 input f
- 3690 let q=q+1
- 3700 if f=1 then 3220
- 3710 if f=2 then 3350
- 3720 if f=3 then 3530
- 3730 if f=4 then 3790
- 3740 if f=5 then 3770
- 3750 if f=6 then 3770
- 3760 goto 3670
- 3770 print fnposcur$(18,1);elr$;"No. This will be explained later. Again, "
- 3780 goto 3670
- 3790 print fnposcur$(18,1);elr$;"Very good! "
- 3800 print elr$;"If 'X' were used for multiply, it might be confused with the variable X. "
- 3810 print elr$:print elr$;"Now, hit any key to practice a little:"
- 3820 gosub 40800
- 3830 print cls$;fnposcur$(10,1)
- 3840 let r=r+1
- 3850 print "How much is 2*3";
- 3860 input g
- 3870 let q=q+1
- 3880 if g=6 then 3910
- 3890 print els$;"No. Remember, * means multiply."
- 3900 goto 3850
- 3910 print els$;"Sure"
- 3920 print "Hit any key to continue: "
- 3930 gosub 40800
- 3940 print cls$;fnposcur$(10,1)
- 3950 let r=r+1
- 3960 print "How much is 3*4+7 ";
- 3970 input h
- 3980 let q=q+1
- 3990 if h=19 then 4050
- 4000 if h=33 then 4030
- 4010 print els$;"Sorry, look again"
- 4020 goto 3960
- 4030 print els$;"No: Multiplications always precede additions."
- 4040 goto 3960
- 4050 print els$;"Right you are."
- 4060 print "Hit any key to continue: "
- 4070 gosub 40800
- 4080 print cls$;fnposcur$(10,1)
- 4090 let r=r+1
- 4100 print "How much is 3*(1+5)/2 ";
- 4110 input i
- 4120 let q=q+1
- 4130 if i=9 then 4160
- 4140 print els$;"No: operations within () precede others."
- 4150 goto 4100
- 4160 print els$;"Good"
- 4170 print "Hit any key to continue: "
- 4180 gosub 40800
- 4190 let r=r+1
- 4200 print cls$
- 4210 print "That leaves ^ which is our way to indicate squares, cubes, etc."
- 4220 print "Such as X^2 for 'X SQUARED' or X*X, Y^3 for Y*Y*Y, etc."
- 4230 print "We also can use functions such as sine, cosine, etc., and"
- 4240 print "you can even define your own, but these will be covered in"
- 4250 print "another lesson.
- 4260 print : print "Hit any key to continue: "
- 4270 gosub 40800
- 4280 print cls$;fnposcur$(4,1);
- 4290 print "We'll use SQR (square root) in our coming"
- 4300 print "example to give you the idea. Let's assume you want to compose"
- 4310 print "a program to compute radius vectors (the square root of the"
- 4320 print "sum of the squares of three components.) This program will"
- 4330 print "be a sequence of statements to tell the computer what to do."
- 4340 print "How do you think these statements should be numbered?"
- 4350 print " (1) consecutively (1, 2, 3, etc. )"
- 4360 print " (2) incrementally (10, 20, 30, etc.)"
- 4370 print " (3) any sequence, it doesn't matter"
- 4380 print "(Type no. of answer)"
- 4390 input j
- 4400 let q=q+1
- 4410 if j=1 then 4470 else if j=2 then 4450
- 4420 print "The computer needs to have the numbers of the statements"
- 4430 print "in sequential order when it runs your program. Remember, too,"
- 4440 goto 4460
- 4450 print "Right."
- 4460 let r=r+1
- 4470 print "Leaving space between numbers permits easier insertions, later"
- 4480 print : print "Hit any key to continue: "
- 4490 gosub 40800
- 4500 print cls$;fnposcur$(4,1);
- 4510 print "For our sample program, let's first call for our known "
- 4520 print "variables. We simply type:"
- 4530 print
- 4540 print "10 INPUT X, Y, Z"
- 4550 print
- 4560 print "10 is simply the first statement number. The word"
- 4570 print "'INPUT' tells the computer to accept the following"
- 4580 print "data from the user terminal. X, Y, and Z are our"
- 4590 print "'DATA'.
- 4600 print : print "Hit any key to continue: "
- 4610 gosub 40800
- 4620 print cls$;fnposcur$(4,1);
- 4630 print "Next, we write our equation by typing:"
- 4640 print
- 4650 print "20 LET R = SQR (X^2 + Y^2 + Z^2)"
- 4660 print
- 4670 print "where 20 is the next statement number, 'LET' tells the computer"
- 4680 print "that an equation is coming, and 'R' is our unknown variable."
- 4690 print "Note: unknowns must be to the left of the '=' and knowns are"
- 4700 print "on the right. SQR is the square root function mentioned"
- 4710 print "earlier. The rest is algebra the way it has to be typed on the keyboard"
- 4720 print : print "Hit any key to continue: "
- 4730 gosub 40800
- 4740 print cls$;fnposcur$(4,1);
- 4750 print "From this point on, 'R' can be treated as a "
- 4760 print "'KNOWN' in other equations (in the same program).
- 4770 print "In this example, we'll tell the computer to print
- 4780 print "the value of 'R' by typing the statement:"
- 4790 print
- 4800 print "30 PRINT R"
- 4810 print
- 4820 print "WHich will cause the computer to do just that."
- 4830 print : print "Hit any key to continue: "
- 4840 gosub 40800
- 4850 print cls$;fnposcur$(4,1);
- 4860 print "We now add an 'END' statement and this is our complete program:"
- 4870 print
- 4880 print "10 INPUT X, Y, Z"
- 4890 print "20 LET R = SQR (X^2 + Y^2 + Z^2)"
- 4900 print "30 PRINT R"
- 4910 print "40 END"
- 4920 print
- 4930 print "When 'RUN' is typed, the program will call for the values of"
- 4940 print "X, Y, and Z with a question mark (?)."
- 4950 print : print "Hit any key to continue: "
- 4960 gosub 40800
- 4970 print cls$;fnposcur$(4,1);
- 4980 print " (Try it: type any 3 numbers, separated by commas:)"
- 4990 input x, y, z
- 5000 print sqr(x^2+y^2+z^2);" (This is your 'R', or RADIUS VECTOR.)"
- 5010 print : print "Hit any key to continue: "
- 5020 gosub 40800
- 5030 print cls$;fnposcur$(4,1);
- 5040 print "Well, the hard part is over and now the fun begins. By the"
- 5050 print "way, you have answered";R;" correctly out of";Q;"questions."
- 5060 print "In order to continue what we have begun, you should"
- 5070 print "request the next lesson in the sequence from me. To do this,"
- 5080 print "return to the menu and ask for 'TUTR02'. "
- 5090 print "I'll meet you there. LAST ONE THERE IS A HUMAN! "
- 5100 print "Hit any key to return to the menu: "
- 5110 gosub 40800
- 5120 RUN "MENU"
- 5130 end