I seem to get an error after int main (void) saying 'a function definition isnt aloowed here before { token? And then also at the end of main saying 'expexted } at end of output?
My programme is trying to create a random array of 100 ints between 0 and 250, sort them and print them.
1) Please use code tags, to make your code more readable.
2) You haven't closed all the braces that you opened in your bubbleSort method. You'd find this sort of thing easier to spot if you adopted a consistent indentation policy.
You need to define the printElements function before the bubbleSort one
Also, in the main function, the loop over i should be from 0 to <100, since select has 100 elements.
Other comments:
- don't use stdio.h, so don't include it
- in modern compilers <stdlib.h> and <time.h> should be replaced by <cstdlib> and <ctime>
I debugged your code and took the freedom to fix the indentation etc. Always try to write readable code .
As ats15 commented + you missed the std namespace. an extra print funk bubble sort, forgot to use your parameters. tried to write 250 ints to a aray of 100 elements. you also turned to > the wrong way in bubble sort. :)