ChipMaster's bwBASIC
This also includes history going back to v2.10. *WARN* some binary files might have been corrupted by CRLF.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- 10 REM BUBBLESORT NUMBERS
- 80 CALL SHELL("cls")
- 90 DIM A(8)
- : REM ARRAY WITH MAX 8 ELEMENTS
- 100 REM ASK FOR 8 NUMBERS
- 105 PRINT "You will be asked for 8 numbers"
- 110 FOR I = 1 TO 8
- 120 PRINT "TYPE NUMBER ";I;" : ";
- 130 INPUT A (I)
- 140 NEXT I
- 150 REM PASS THROUGH 8 NUMBERS, TESTING BY PAIRS
- 160 F = 0
- : REM RESET THE ORDER INDICATOR
- 170 FOR I = 1 TO 7
- : REM NOTE THAT ENDING INDEX IS 8 MINUS 1
- 180 IF A(I) <= A(I+1) THEN
- : GOTO 240
- : END IF
- 190 REM SWAP A (I) AND A (I+1)
- 200 T = A(I)
- 210 A(I) = A(I+1)
- 220 A(I+1) = T
- 230 F = 1
- : REM ORDER WAS NOT PERFECT
- 240 NEXT I
- 250 REM F = 0 MEANS ORDER IS PERFECT
- 260 IF F = 1 THEN
- : GOTO 160
- : END IF
- : REM TRY AGAIN
- 270 PRINT
- : REM PRINT EMPTY LINE
- 280 REM PRINT ORDERED NUMBERS
- 290 FOR I = 1 TO 8
- 300 PRINT A (I)
- 310 NEXT I
- 315 PRINT
- 320 END
|