home *** CD-ROM | disk | FTP | other *** search
- 00005 REM Basic Program : bas-exam.spe
- 00007 REM Date written : 19.3.86
- 00009 REM Author : vom Bovert
- 00011 REM Structogram saved on disk : 35
- 00013 REM Basicsource saved on disk : 35
- 00015 REM
- 00017 REM main program
- 00019 REM
- 00025 REM assignments
- 00027 t1$ = "Program Name: bas-exam"
- 00029 t2$ = "Create file (1), display file (2)?"
- 00035 PRINT t1$
- 00037 REM an unconditioned loop is following
- 00043 rem
- 00055 PRINT t2$
- 00057 INPUT zchen$
- 00065 REM case
- 00071 rem
- 00075 IF zchen$ = "1" goto 00079 else goto 00091
- 00079 rem
- 00081 REM case 1
- 00083 REM create file
- 00085 gosub 00279
- 00087 goto 00119
- 00091 rem
- 00095 IF zchen$ = "2" goto 00099 else goto 00111
- 00099 rem
- 00101 REM case 2
- 00103 REM display file
- 00105 gosub 00139
- 00107 goto 00119
- 00111 rem
- 00113 REM else-case
- 00115 REM end
- 00117 goto 00124
- 00119 rem
- 00123 goto 00043
- 00124 rem
- 00129 REM end of program
- 00131 END
- 00138 end
- 00139 rem
- 00141 rem zweite subroutine
- 00143 rem
- 00145 rem s u b r o u t i n e display file
- 00147 rem
- 00159 REM assignment
- 00161 t3$ = "Display another record (y/n)?"
- 00167 REM open file
- 00169 OPEN "basbsp1.dat" FOR INPUT AS 1
- 00171 a = 1 : REM initiate
- 00173 REM condition
- 00181 REM conditioned loop
- 00183 WHILE a = 1
- 00197 REM reading sucessful ?
- 00199 IF eof(1) goto 00203 else goto 00211
- 00203 rem
- 00205 REM End of file
- 00207 goto 00256
- 00210 goto 00251
- 00211 rem
- 00215 LINE INPUT #1,eins$ : REM input line
- 00217 PRINT eins$ : REM display line
- 00219 PRINT t3$
- 00227 REM another record ?
- 00229 INPUT zchen$
- 00231 IF zchen$ = "y" goto 00235 else goto 00241
- 00235 rem
- 00237 REM yes
- 00240 goto 00247
- 00241 rem
- 00243 REM no
- 00245 a = 0
- 00247 rem
- 00251 rem
- 00255 wend
- 00256 rem
- 00261 REM close file
- 00263 CLOSE 1
- 00271 return
- 00278 end
- 00279 rem
- 00281 rem basbsp subroutine
- 00283 rem
- 00285 rem s u b r o u t i n e write file
- 00287 rem
- 00299 REM assignment
- 00301 t4$ = "How many records are to be written?"
- 00307 REM create file
- 00309 OPEN "basbsp1.dat" FOR OUTPUT AS 1
- 00311 PRINT t4$
- 00313 INPUT anzahl : REM input number of records
- 00321 REM indexed loop
- 00323 REM
- 00325 FOR zaehl = 1 TO anzahl
- 00335 INPUT auss$ : REM input record
- 00337 PRINT auss$ : REM display record
- 00339 PRINT #1,auss$ : REM write record
- 00341 next
- 00342 rem
- 00347 REM close file
- 00349 CLOSE 1
- 00357 return