Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
|
|
@ -0,0 +1,31 @@
|
|||
PROGRAM BUBBLE_SORT
|
||||
|
||||
DIM FLIPS%,N,J
|
||||
|
||||
DIM A%[100]
|
||||
|
||||
BEGIN
|
||||
|
||||
! init random number generator
|
||||
RANDOMIZE(TIMER)
|
||||
! fills array A% with random data
|
||||
FOR N=1 TO UBOUND(A%,1) DO
|
||||
A%[N]=RND(1)*256
|
||||
END FOR
|
||||
! sort array
|
||||
FLIPS%=TRUE
|
||||
WHILE FLIPS% DO
|
||||
FLIPS%=FALSE
|
||||
FOR N=1 TO UBOUND(A%,1)-1 DO
|
||||
IF A%[N]>A%[N+1] THEN
|
||||
SWAP(A%[N],A%[N+1])
|
||||
FLIPS%=TRUE
|
||||
END IF
|
||||
END FOR
|
||||
END WHILE
|
||||
! print sorted array
|
||||
FOR N=1 TO UBOUND(A%,1) DO
|
||||
PRINT(A%[N];)
|
||||
END FOR
|
||||
PRINT
|
||||
END PROGRAM
|
||||
Loading…
Add table
Add a link
Reference in a new issue