I'd suggest learning Python, its a great programming and scripting language. With Python and C++ together you can't loose.
Python is also open-source, allowing you to create C/C++ extensions for Python or embed Python into a C/C++ application which is what I'm doing.
Python Code:
PHP Code:
def SelectionSort(array):
for a in range(len(array)):
for b in range(a + 1, len(array)):
if array[b] < array[a]:
tmp = array[b]
array[b] = array[a]
array[a] = tmp
#Testing code
data = [1, 6, 4, 2, 5, 8, 20, 100, 54, 1000, 523]
SelectionSort(data)
print(data) #Prints: [1, 2, 4, 5, 6, 8, 20, 54, 100, 523, 1000]
Quote:
Originally Posted by Programmer
I converted it to GScript so that it can be tested by Graal developers.
|
How dare you place any code outside of a function

And you're making global variables.