June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
21
Task/Balanced-brackets/BASIC/balanced-brackets-2.basic
Normal file
21
Task/Balanced-brackets/BASIC/balanced-brackets-2.basic
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
10 PRINT CHR$(147): REM CLEAR SCREEN
|
||||
20 FOR N=1 TO 7
|
||||
30 READ S$
|
||||
40 IF S$="" THEN PRINT"(EMPTY)";: GOTO 60
|
||||
50 PRINT S$;
|
||||
60 PRINT TAB(20);
|
||||
70 GOSUB 1000
|
||||
80 NEXT N
|
||||
90 END
|
||||
100 REM ********************************
|
||||
1000 S = 0
|
||||
1010 FOR K=1 TO LEN(S$)
|
||||
1020 C$ = MID$(S$,K,1)
|
||||
1030 IF C$="[" THEN S = S+1
|
||||
1040 IF C$="]" THEN S = S-1
|
||||
1050 IF S<0 THEN PRINT "NOT OK": RETURN
|
||||
1060 NEXT K
|
||||
1070 IF S=0 THEN PRINT "OK": RETURN
|
||||
1090 PRINT "NOT OK"
|
||||
1100 RETURN
|
||||
2000 DATA , [], ][, [][], ][][, [[][]], []][[]
|
||||
Loading…
Add table
Add a link
Reference in a new issue