Google
 

Trailing-Edge - PDP-10 Archives - decuslib20-01 - decus/20-0024/tutr01.bas
There are 2 other files named tutr01.bas in the archive. Click here to see a list.
00100	REM   TUT1
00120	LETQ=0
00130	LETR=0
00140	PRINT"WELCOME TO TIMESHARING PDP-10.WE WILL"
00150 PRINT "TRY TO TEACH YOU ENOUGH ABOUT THE SYSTEM IN THIS SITTING SO THAT"
00160 PRINT "YOU WILL BE ABLE TO WRITE YOUR OWN COMPUTER PROGRAMS."
00170	PRINT
00180	PRINT"BEFORE WE CAN WRITE A PROGRAM WE NEED TO REVIEW THE SYMBOLS"
00190	PRINT"AVAILABLE:"
00200	PRINT
00210	PRINT"  (1) +"
00220	PRINT"  (2)  -"
00230	PRINT"  (3)   /"
00240	PRINT"  (4)    *"
                                                          00250	PRINT"  (5)    ( )	 "
00260	PRINT"  (6)      ^"
00270	PRINT
00280	PRINT"AFTER THE ? BELOW TYPE THE NUMBER OF YOUR ANSWER"
00290	PRINT
00300	PRINT"WHICH OF THE ABOVE SYMBOLS IS USED FOR ADDITION";
00310	LETQ=Q+1
00320	INPUTC
00330	IFC=1THEN 450
00340	IFC=2THEN 430
00350	IFC=3THEN 410
00360	IFC>3THEN390
00370	PRINT"TYPE THE NUMBER OF YOUR ANSWER, NOT THE SYMBOL"
00380 GOTO300
00390 PRINT"SORRY. GUESS AGAIN."
00400	GOTO300
00410	PRINT"NO. ONCE AGAIN..."
00420	GOTO300
00430	PRINT"YOU DON'T MEAN THAT."
00440	GOTO300
                                                                    00450	PRINT "GOOD."
00460	LETR=R+1
00470	PRINT"WHICH SYMBOL IS USED FOR SUBTRACTION";
00480	INPUTD
00490	LETQ=Q+1
00500	IFD>3THEN560
00510	IFD=3THEN 610
00520	IFD=2THEN 580
00530	IFD<=0THEN560
00540	PRINT"COME ON NOW; YOU JUST TOLD ME THAT ONE WAS FOR ADDITION. SO..."
00550	GOTO470
00560	PRINT"PLEASE GUESS AGAIN."
00570	GOTO 470
00580	PRINT"RIGHT"
00590	LETR=R+1
00600	GOTO 630
00610	PRINT"YOU CAN'T BE SERIOUS."
00620	GOTO560
00630	PRINT"WHICH SYMBOL IS USED FOR DIVISION";
00640	INPUTE
00650	LETQ=Q+1
00660	IFE=3THEN 740
00670	IFE>3THEN 720
                                                               00680	IF E<=0 THEN 720
00690	PRINT"YOU MUST NOT HAVE BEEN LOOKING AT WHICH KEY YOU HIT - WE'VE"
00700	PRINT"ALREADY USED THIS CHOICE.  ONCE MORE......"
00710	GOTO630
00720	PRINT"TRY AGAIN."
00730	GOTO 630
00740	PRINT"GOOD FOR YOU. NOW THE NEXT ONE IS TRICKY:"
00750	LETR=R+1
00760	PRINT"WHICH SYMBOL IS USED FOR MULTIPLICATION";
00770	INPUTF
00780	LETQ=Q+1
00790	IFF=1THEN 300
00800	IFF=2THEN 430
00810	IFF=3THEN 610
00820	IFF=4THEN 880
00830	IFF=5THEN860
00840	IFF=6THEN 860
00850	GOTO 760
00860	PRINT"NO. THIS WILL BE EXPLAINED LATER. AGAIN,"
                            00870	GO TO 760
00880	PRINT"VERY GOOD. IF'X' WERE USED FOR MULTIPLY, IT COULD BE CONFUSED"
00890	PRINT"WITH THE VARIABLE X. LET'S PRACTICE A LITTLE:"
00900	LETR=R+1
00910	PRINT"HOW MUCH IS 2*3";
00920	INPUTG
00930	LETQ=Q+1
00940	IFG=6THEN 970
00950	PRINT"NO. REMEMBER, * MEANS MULTIPLY."
00960	GOTO 910
00970	PRINT"SURE"
00980	LETR=R+1
00990	PRINT"HOW MUCH IS 3*4+7 ";
01000	INPUTH
01010	LETQ=Q+1
01020	IFH=19THEN 1080
01030	IFH=33THEN 1060
01040	PRINT"SORRY, LOOK AGAIN"
01050	GOTO 990
01060	PRINT"NO: MULTIPLICATIONS ALWAYS PRECEDE ADDITIONS."
                      01070	GO TO 990
01080	PRINT"RIGHT YOU ARE."
01090	LETR=R+1
01100	PRINT"HOW MUCH IS 3*(1+5)/2 ";
01110	INPUTI
01120	LETQ=Q+1
01130	IFI=9THEN1160
01140	PRINT"NO: OPERATIONS WITHIN () PRECEDE OTHERS."
01150	GOTO 1100
01160	PRINT"GOOD"
01170	LETR=R+1
01180	PRINT"THAT LEAVES ^ WHICH IS OUR WAY TO INDICATE SQUARES, CUBES,ETC."
01190	PRINT"SUCH AS X^2 FOR 'X SQUARED' OR X*X, Y^3 FOR Y*Y*Y, ETC."
01200	PRINT"WE ALSO CAN USE FUNCTIONS SUCH AS SINE, COSINE, ETC., AND"
01210	PRINT"YOU CAN EVEN DEFINE YOUR OWN, BUT THESE WILL BE COVERED IN"
       01220	PRINT"ANOTHER LESSON.  WE'LL USE SQR (SQUARE ROOT) IN OUR COMING"
01230	PRINT"EXAMPLE TO GIVE YOU THE IDEA. LET'S ASSUME YOU WANT TO COMPOSE"
01240	PRINT"A PROGRAM TO COMPUTE RADIUS VECTORS (THE SQUARE ROOT OF THE"
01250	PRINT"SUM OF THE SQUARES OF THREE COMPONENTS.)  THIS PROGRAM WILL"
01260	PRINT"BE A SEQUENCE OF STATEMENTS TO TELL THE COMPUTER WHAT TO DO."
01270	PRINT"DO YOU THINK THESE STATEMENTS SHOULD BE NUMBERED:"
01280	PRINT" (1) CONSECUTIVELY (1, 2, 3, ETC. )"
01290	PRINT" (2) INCREMENTALLY (10, 20, 30, ETC.)"
                           01300	PRINT"(3) ANY SEQUENCE FOR IT DOEN'T MATTER"
01310	PRINT"(TYPE NO. OF ANSWER)"
01320	INPUTJ
01330	LETQ=Q+1
01340	IFJ=2THEN 1380
01350	PRINT"WELL, THE COMPUTER DOESN'T CARE SINCE IT SIMPLY WILL DO THEM"
01360	PRINT"IN SEQUENTIAL ORDER WHEN IT RUNS YOUR PROGRAM, HOWEVER"
01370	GOTO 1390
01380	PRINT"RIGHT."
01390	LETR=R+1
01400	PRINT"LEAVING SPACE BETWEEN NUMBERS PERMITS EASIER INSERTIONS LATER."
01410	PRINT"FOR OUR SAMPLE PROGRAM, LET'S FIRST CALL FOR OUR KNOWN "
01420	PRINT"VARIABLES.  WE SIMPLY TYPE:"
01430	PRINT
01450	PRINT
01460	PRINT"10 IS SIMPLY THE FIRST STATEMENT NUMBER. X,Y, AND Z ARE"
01470	PRINT"OUR 'DATA'. NEXT WE WRITE OUR EQUATION BY TYPING:"
01480	PRINT
01490	PRINT"20 LET R = SQR (X^2 + Y^2 + Z^2)"
01500	PRINT
01510	PRINT"WHERE 20 IS THE NEXT STATEMENT NUMBER, 'LET' TELLS THE COMPUTER"
01520	PRINT"THAT AN EQUATION IS COMING, AND 'R' IS OUR UNKNOWN VARIABLE."
01530	PRINT"NOTE: UNKNOWNS MUST BE ON THE LEFT OF THE '=' AND KNOWNS ARE"
01540	PRINT"ON THE RIGHT. SQR IS THE SQUARE ROOT FUNCTION MENTIONED"
            01550	PRINT"EARLIER. THE REST IS TELETYPE ALGEBRA. FROM THIS POINT ON"
01560	PRINT"'R' CAN BE TREATED AS A 'KNOWN' IN OTHER EQUATIONS. IN THIS"
01570	PRINT"EXAMPLE WE'LL TELL THE COMPUTER TO PRINT THE VALUE OF R"
01580	PRINT"BY TYPING THE STATEMENT:"
01590	PRINT
01600	PRINT"30 PRINT R"
01610	PRINT
01620	PRINT"WHICH WILL CAUSE THE COMPUTER TO DO JUST THAT. WE NOW ADD"
01630	PRINT"AN 'END' STATEMENT AND THIS IS OUR COMPLETE PROGRAM:"
01640	PRINT
01650	PRINT"10 INPUT X, Y, Z"
01660	PRINT"20 LET R = SQR (X^2 + Y^2 + Z^2)"
                                01670	PRINT"30 PRINT R"
01680	PRINT"40 END"
01690	PRINT
01700	PRINT"WHEN 'RUN' IS TYPED, THE PROGRAM WILL CALL FOR VALUES OF"
01710	PRINT"X, Y, AND Z WITH A QUESTION MARK."
01720	PRINT"        (TRY IT: TYPE ANY 3 NUMBERS SEPARATED BY COMMAS.)"
01730	INPUTX,Y,Z
01740	PRINTSQR(X^2+Y^2+Z^2);"  (THIS IS YOUR 'R' OR RADIUS VECTOR.)"
01750	PRINT"WELL, THE HARD PART IS OVER AND NOW THE FUN BEGINS. BY THE"
01760	PRINT"WAY YOU HAVE ANSWERED";R;"CORRECTLY OUT OF";Q;"QUESTIONS."
01770	PRINT"IN ORDER TO CONTINUE WHAT WE HAVE BEGUN, IT WILL BE NECESSARY"
       01780	PRINT"TO REQUEST ANOTHER PROGRAM FROM ME. TO DO THIS,"
01790	PRINT"TYPE 'OLD' AND USE 'TUTR02*' FOR THE PROBLEM NAME. WHEN"
01800	PRINT"THE COMPUTER  RESPONDS WITH AN'*' TYPE 'RUN' AND I'LL MEET YOU THERE."
01810	PRINT"LAST ONE THERE IS A HUMAN. GOOD LUCK."
01820	END