Sorting algorithms/Bubble sort: Difference between revisions

Content added Content deleted
(Added EasyLang implementation)
Line 1,294: Line 1,294:
920 DATA 64,34,25,12,22,11,90,13,59,47,19,89,10,17,31
920 DATA 64,34,25,12,22,11,90,13,59,47,19,89,10,17,31
</syntaxhighlight>
</syntaxhighlight>

=={{header|Craft Basic}}==
<syntaxhighlight lang="basic">define sort = 0, index = 0, size = 10
define temp1 = 0, temp2 = 0

dim list[size]

let index = 0
do

let list[index] = int: (rnd) * 100

let index = index + 1

loop index < size

do

let sort = 0

let index = 0

do

let temp1 = index + 1

if list[index] > list[temp1] then

let temp2 = list[index]
let list[index] = list[temp1]
let list[temp1] = temp2
let sort = 1

endif

let index = index + 1

loop index < size - 1

wait

loop sort = 1

let index = 0

do

print index ," : ", list[index]

let index = index + 1

loop index < size</syntaxhighlight>


==={{header|FreeBASIC}}===
==={{header|FreeBASIC}}===