Page images
PDF
EPUB

310 PRINT

320 PRINT "END PROGRAM 16"

330 END

? UNDEFINED LINE NUMBER 275 IN LINE 240

*** **

10 PRINT "PROGRAM FILE 17: ELEMENTARY USE OF GOSUB AND RETURN." 20 PRINT " ANSI STANDARD 10.2, 10.4"

30 PRINT

40 PRINT "SECTION 17.1: ELEMENTARY USE OF GOSUB AND RETURN." 50 PRINT

52 PRINT "THIS PROGRAM TESTS THAT THE SUBROUTINE MECHANISM EXISTS" 54 PRINT "AND THAT A SUBROUTINE CAN BE INVOKED FROM SEVERAL"

56 PRINT "PLACES IN THE MAIN LINE OF CONTROL. 11

58 PRINT

60 PRINT "

70 PRINT

BEGIN TEST."

80 PRINT "IF THE NEXT MESSAGE '*** GOSUB TEST PASSED *** IS"

90 PRINT "SPELLED CORRECTLY, THE TEST PASSED."

[merged small][merged small][merged small][merged small][merged small][merged small][merged small][ocr errors][merged small]

PROGRAM FILE 17: ELEMENTARY USE OF GOSUB AND RETURN.
ANSI STANDARD 10.2, 10.4

SECTION 17.1: ELEMENTARY USE OF GOSUB AND RETURN.

THIS PROGRAM TESTS THAT THE SUBROUTINE MECHANISM EXISTS
AND THAT A SUBROUTINE CAN BE INVOKED FROM SEVERAL
PLACES IN THE MAIN LINE OF CONTROL.

[blocks in formation]

10 PRINT "PROGRAM FILE 18: THE IF-THEN STATEMENT WITH STRING OPERANDS." 20 PRINT " ANSI STANDARD 10.2, 10.4"

30 PRINT

40 PRINT "SECTION 18.1: THE IF-THEN STATEMENT WITH STRING OPERANDS." 50 PRINT

60 PRINT "THIS SECTION TESTS THE COMPARISON OF STRING VARIABLES AND" 70 PRINT "CONSTANTS WITH A VARIETY OF VALUES. BOTH RELATIONSHIPS" 80 PRINT "(= AND <>) ARE TESTED FOR EACH PAIR OF VALUES. THE 'V' OR" 90 PRINT "'C' FOLLOWING THE COMPARAND VALUE INDICATES WHETHER IT IS" 100 PRINT "A VARIABLE OR A CONSTANT."

110 PRINT

120 PRINT "'T' OR 'F' IS PRINTED TO SHOW THE OUTCOME OF THE" 130 PRINT "COMPARISON. FOR INCORRECT COMPARES, AN '*' IS PRINTED" 140 PRINT "NEXT TO THE ERRONEOUS RESULT. WHEN DISPLAYING COMPARAND"

150 PRINT "VALUES, THE UNDERLINE CHARACTER, '' IS USED TO REPRESENT" 160 PRINT "THE SPACE CHARACTER (THUS A DISPLAYED 'ONE BLANK' " 170 PRINT "INDICATES AN INTERNAL VALUE OF 'ONE BLANK']."

171 PRINT "ALSO, THE NULL STRING (LENGTH OF ZERO) IS DENOTED BY THE" 172 PRINT "LABEL (NULL STRING)'."

180 PRINT

190 PRINT "CHARACTER STRINGS SHOULD TEST EQUAL IF AND ONLY IF THE" 200 PRINT "STRINGS ARE EQUAL IN LENGTH AND CONTAIN IDENTICAL SEQUENCES" 210 PRINT "OF CHARACTERS."

[blocks in formation]

250 PRINT "LEFT":TAB(22);": RIGHT"

260 PRINT "COMPARAND"; TAB(19); "V/C: COMPARAND"; TAB(42); "V/C";

270 PRINT TAB(47);""; TAB(51); "<>"; TAB (55); "RESULT"

275 PRINT

[merged small][merged small][merged small][merged small][merged small][merged small][merged small][merged small][merged small][merged small][merged small][merged small][ocr errors][ocr errors][merged small][merged small][merged small][merged small][merged small]

700 LET W$="(NULL STRING)" 710 GOSUB 4500

720 LET T$="18 CHARACTERS LONG" 730 LET V$="18 CHARACTERS LONG" 740 LET U$="18 CHARACTERS LONG" 750 LET W$="18 CHARACTERS LONG" 760 GOSUB 4000

770 LET U$="18 CHARACTERS LONK" 780 LET W$="18 CHARACTERS LONK" 790 GOSUB 4500

800 LET T$="! #$%&'( )0=+*<>?"
810 LET V$="! #$%&'( )0=+*<>?"
820 LET U$="! #$%&'()0=+#<>?"
830 LET W$="! #$%&'( )0=+*<>?"
840 GOSUB 4000
850 LET T$=""

[merged small][merged small][ocr errors][merged small][merged small][merged small][merged small][merged small][merged small][merged small][merged small][merged small][merged small][merged small][merged small][merged small][merged small][merged small][ocr errors][merged small][merged small][merged small]

2900 REM SUBROUTINE TO PRINT COMPARANDS FOR CONSTANT:VARIABLE 2910 PRINT "ABC"; TAB (20);"C : ";V$;TAB(43);"V";

[merged small][merged small][merged small][merged small][merged small][ocr errors]
[merged small][merged small][merged small][merged small][ocr errors][merged small][merged small]

3900 REM SUBROUTINE TO PRINT COMPARANDS FOR VARIABLE: CONSTANT 3910 PRINT V$; TAB(20); "V : _0X9__";TAB(43);"C";

3920 RETURN

4000 REM SUBROUTINE TO TEST VARIABLE = VARIABLE

4005 LET B$="T*"

4010 LET A$="T"

4020 LET L$=" OK 11

4030 IF T$<>U$ THEN 4060

4040 LET B$="F"

4050 GOTO 4080

4060 LET R$="FAILED"

4070 LET L$="FAILED"

4080 IF T$=U$ THEN 4120

4090 LET R$="FAILED"

4100 LET L$="FAILED"

4110 LET A$="F*"

4120 GOSUB 4900

4125 GOSUB 5000

4130 RETURN

4500 REM SUBROUTINE TO TEST VARIABLE <> VARIABLE

4505 LET A$="T"

4510 LET B$="T"

4520 LET L$="

OK

4530 IF T$=U$ THEN 4560

4540 LET A$="F"

4550 GOTO 4580

4560 LET R$="FAILED"

« PreviousContinue »