Data update
This commit is contained in:
parent
9817d9b99b
commit
07c7092a52
140 changed files with 2712 additions and 241 deletions
|
|
@ -0,0 +1,29 @@
|
|||
100 REM Remove duplicate elements
|
||||
110 DIM DataArray(1 TO 7), ResultArray(1 TO 7)
|
||||
120 ! Set the data.
|
||||
130 FOR I = 1 TO 7
|
||||
140 READ DataArray(I)
|
||||
150 NEXT I
|
||||
160 ! Remove duplicates
|
||||
170 LET ResultArray(1) = DataArray(1)
|
||||
180 LET LastResultIndex = 1
|
||||
190 LET Position = 1
|
||||
200 DO WHILE Position < UBOUND(DataArray)
|
||||
210 LET Position = Position + 1
|
||||
220 LET IsNewNumber = -1
|
||||
230 FOR ResultIndex = 1 TO LastResultIndex
|
||||
240 IF DataArray(Position) = ResultArray(ResultIndex) THEN
|
||||
250 LET IsNewNumber = 0
|
||||
260 EXIT FOR
|
||||
270 END IF
|
||||
280 NEXT ResultIndex
|
||||
290 IF IsNewNumber = -1 THEN
|
||||
300 LET LastResultIndex = LastResultIndex + 1
|
||||
310 LET ResultArray(LastResultIndex) = DataArray(Position)
|
||||
320 END IF
|
||||
330 LOOP
|
||||
340 FOR ResultIndex = 1 TO LastResultIndex
|
||||
350 PRINT ResultArray(ResultIndex)
|
||||
360 NEXT ResultIndex
|
||||
370 DATA 1, 2, 2, 3, 4, 5, 5
|
||||
380 END
|
||||
Loading…
Add table
Add a link
Reference in a new issue