Our doctor wrote the function ,, and i wanted to use it , i did find the mistake like > greater then and the declaration
PHP Code:
# include <iostream>
using namespace std;
void bubblesort ( int array[] , int length );
int main () {
int array [10]={10,20,30,40,50};
for ( int i=0; i<10; i++)
cout <<bubblesort(array,10);
return 0;
}
void bubblesort ( int array[], int length ) {
int step , index , temp;
for ( step =1; step<length; step++)
{
for ( index=0; index<length-step; index++)
if ( array [index] > array [ index+1 ])
{
temp = array [ index];
array [index] = array [index+1];
array [index+1] = temp;
}
}
}




Reply With Quote