Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-01 - 43,50141/tutr04.bas
There are 2 other files named tutr04.bas in the archive. Click here to see a list.
00001REM   TUT4
00100GOTO 130
00110PRINT"NO SUCH CHOICE. TRY AGAIN. WHICH";
00120RETURN
00130PRINT"HELLO AGAIN. LET'S HAVE A QUICK REVIEW. USE THIS CODE:"
00140PRINT
00150PRINT"     1=PRINT; 2=INPUT; 3=LET; 4=GO TO; 5=END"
00160PRINT
00170PRINT"WHICH OF THE ABOVE IS USED FOR ARITHMETIC OPERATIONS";
00180INPUTL
00190PRINT
00200IFL=3THEN 240
00210IFL<=5THEN 260
00220GOSUB 110
00230GOTO 180
00240PRINT"VERY GOOD. WHICH ONE ALWAYS PRODUCES A QUESTION MARK";
             00250GOTO 280
00260PRINT"GOOD TRY......BUT IT ISN'T RIGHT. ONCE MORE....";
00270GOTO 180
00280INPUTM
00290PRINT
00300IFM=2THEN 360
00310IFM<=5THEN 340
00320GOSUB 110
00330GOTO 280
00340PRINT"TAKE A 5-SECOND BREAK AND TRY AGAIN. IT SHOULD BE...";
00350GOTO 280
00360PRINT"EXCELLENT. YOU SEEM TO KNOW THEM. NOW LET US LOOK AT SOME"
00400PRINT"ADDITIONAL KINDS OF STATEMENTS AND SEE HOW TO USE THEM. FIRST"
00410PRINT"WE'LL LOOK AT 'READ' AND 'DATA', WHICH MUST BOTH BE USED IF"
00420PRINT"EITHER ONE IS USED."
                                                00430PRINT
00440PRINT"WHICH ANSWER WOULD YOU PICK FOR THE FOLLOWING QUESTION?"
00450PRINT"     (USE 1=LET, 2=INPUT, 3=GO TO, OR 4=PRINT)"
00451PRINT
00452PRINT"'READ' IS SOMETHING LIKE WHICH ONE";
00455INPUTR
00460PRINT
00470IFR<=4THEN520
00500GOSUB110
00510GOTO455
00520IFR=2THEN 550
00530PRINT"WRONG CHOICE. TRY AGAIN. WHICH ONE";
00540GOTO455
00550PRINT"THAT'S CORRECT. IN BOTH CASES INFORMATION IS BEING PUT INTO"
00560PRINT"THE COMPUTER. THE DIFFERENCE (NOTE THIS) IS WHEN IT IS TO BE"
00570PRINT"ENTERED. FOR THE 'INPUT' INSTRUCTION, THE COMPUTER RECEIVES"
        00580PRINT"INFORMATION WHILE THE PROGRAM IS BEING EXECUTED; THE "
00590PRINT"TELETYPE STOPS AND WAITS FOR THE ENTRY. ON THE OTHER HAND,"
00600PRINT"THE 'READ' STATEMENT REQUIRES THAT THE INFORMATION (DATA)"
00610PRINT"BE ALREADY AVAILABLE IN THE COMPUTER'S MEMORY. NOW DO YOU"
00620PRINT"SEE WHERE THE 'DATA' STATEMENT COMES IN?"
00630PRINT
00640PRINT"WHEN THE COMPUTER IS INSTRUCTED TO 'READ', IT IMMEDIATELY"
00650PRINT"LOOKS FOR THE 'DATA' STATEMENT.  THE WORD 'READ' MUST BE"
00660PRINT"FOLLOWED BY THE NAME OR NAMES OF WHAT THE COMPUTER IS TO READ."
   00670PRINT"THE ACTUAL NUMERICAL VALUES WILL BE FOUND AFTER THE WORD"
00680PRINT"'DATA' SO OF COURSE YOU MUST SEE THAT THEY ARE THERE."
00690PRINT
00700PRINT"NOW LET'S RETURN TO OUR RADIUS VECTOR PROBLEM.  INSTEAD OF"
00710PRINT"USING STATEMENTS 9 AND 10, LET'S SAY:"
00720PRINT
00730PRINT"     11 READ X, Y, Z"
00740PRINT
00750PRINT"     12 DATA 3, 4, 12"
00760PRINT
00770PRINT"STUDY THE ABOVE TWO STATEMENTS CAREFULLY.  NOTICE WHERE THE"
00780PRINT"COMMAS ARE (COMMAS ARE VERY IMPORTANT IN COMPUTER DIRECTIONS."
        00790PRINT"YOU MUST NEVER LEAVE ONE OUT OR PUT ONE IN WHERE IT DOES NOT"
00800PRINT"BELONG). WHAT DO YOU THINK THE VALUE OF 'X' IS";
00810INPUTX
00815PRINT
00820IFX=3THEN 910
00830IFX=4THEN 880
00840IFX=12THEN 880
00850PRINT"NO - YOU SEE IT HAS TO BE ONE OF THE NUMBERS FOLLOWING THE"
00860PRINT"WORD 'DATA'. TRY AGAIN NOW.  HOW MUCH IS X";
00870GOTO 810
00880PRINT"THAT'S A GOOD TRY.  YOU CHOSE ONE OF THE NUMBERS FOLLOWING"
00890PRINT"'DATA' BUT NOT THE RIGHT ONE.  ONCE MORE: X=";
00900GOTO 810
00910PRINT"A PERFECT CHOICE. AND WHAT IS Z";
                                 00920INPUTZ
00925PRINT
00930IFZ=12THEN 970
00940PRINT"NO, THAT'S NOT CORRECT. STUDY THE STATEMENTS AGAIN ALONG WITH"
00950PRINT"YOUR PREVIOUS ANSWER CONCERNING X AND TRY AGAIN. Z=";
00960GOTO 920
00970PRINT"RIGHT AGAIN, AND YOU NOW HAVE MASTERED THE FUNDAMENTALS OF"
00980PRINT"THESE TWO TYPES OF STATEMENTS."
00981PRINT
00985PRINT"LET US CONSIDER ONE MORE THING ABOUT 'DATA' - YOU ARE ALLOWED TO"
00990PRINT"HAVE MORE THAN ONE DATA 'SET' WITH THE DATA STATEMENT. "
01000PRINT"FOR INSTANCE, IF WE WANTED TO DETERMINE TWO RADIUS VECTORS"
       01010PRINT"INSTEAD OF ONE, WE COULD REPLACE STATEMENT 12 WITH:"
01020PRINT
01030PRINT"     12 DATA 3, 4, 12, 8, 15, 11"
01040PRINT" "
01050PRINT"THIS STATEMENT CONTAINS TWO X'S, TWO Y'S, AND TWO Z'S.  ONE OF"
01060PRINT"EACH OF THESE HAS BEEN INCLUDED IN STATEMENT 12 ABOVE.  WHICH"
01070PRINT"DO YOU THINK IS THE SECOND Y: THE '8', THE '15', OR THE '11'";
01080INPUTY
01085PRINT
01090IFY=15THEN 1180
01100IFY=8THEN 1150
01110IFY=15THEN 1150
01120GOSUB110
01140GOTO 1080
01150PRINT"NO; TAKE ANOTHER LOOK AT THE FIRST SET OF DATA. NOW WHICH"
       01160PRINT"ONE DO YOU THINK IT IS";
01170GOTO 1080
01180PRINT"THAT IS CORRECT. ALSO, THE SECOND X IS 8 AND THE SECOND Z"
01190PRINT"IS 11. SO FAR SO GOOD."
01200PRINT
01210PRINT"HOWEVER, THE COMPUTER WON'T AUTOMATICALLY READ BOTH SETS,"
01220PRINT"UNLESS IT IS SOMEHOW DIRECTED TO USE THE READ STATEMENT TWICE."
01230PRINT"USE 1=PRINT, 2=GO TO, 3=LET, AND 4=INPUT, AND DECIDE WHICH OF"
01240PRINT"THESE COULD MAKE IT READ MORE THAN ONE SET OF DATA. WHICH";
01250INPUTK
01255PRINT
01260IFK<=4THEN1300
                                                         01270GOSUB110
01280GOTO1250
01300IFK=2THEN1350
01310PRINT"NO, NOT THAT ONE. AGAIN, WHICH";
01320GOTO 1250
01330PRINT"THAT'S NOT A PERMISSIBLE CHOICE. TRY AGAIN: WHICH OF"
01340GOTO 1240
01350PRINT"YOU'RE DOING FINE. THIS ENDS THE 'TUTR04' PART OF YOUR"
01360PRINT"LESSON. NOW CALLTHE PROGRAM 'TUTR05' (USE THE SAME METHOD"
01370PRINT"YOU USED TO CALL 'TUTR04') AND CONTINUE YOUR STUDY."
01380PRINT"GOOD LUCK."
01390END