bubble sorting array

i have the following program:
#include<iostream>
using namespace std;

int BubbleSort(int a[],int arraysize);

int main()
{
const int arraysize = 10;
int a[arraysize] = {2,4,3,7,2,11,99,88,12,70};

int results3;


results3= BubbleSort(a,arraysize);





cout<<results3;
cin>>results3;

return 0;
}

int BubbleSort(int a[], int array_size)
{
int i, j, temp;
for (i = 0; i < (array_size - 1); ++i)
{
for (j = 0; j < array_size - 1 - i; ++j )
{
if (a[j] > a[j+1])
{
temp = a[j+1];
a[j+1] = a[j];
a[j] = temp;
}
}
}
return temp;
}

im trying to get the mentioned array sorted,but all i get is a two. can anyone help?
Why is a sorting routine returning a value?
How can you tell the array is not being sorted without printing the array?
Last edited on
how would i do that?
Topic archived. No new replies allowed.