include
using namespace std;
//Function prototype
int* selectSort(int ,int);
void showArray(const int [],int);
int main()
{
int array[] = {7,2,4,5,9,10};
int size = sizeof(array)/sizeof(array[0]);//求数组的长度
showArray(array,size);
selectSort(array,size);
showArray(array, size);
cout <
}
int
{
int temp;
int swap;
do
{
swap = false;
for (int i = 0; i < (size - 1);i++)
{
if ((p+i) > (p +i+ 1))
{
temp = (p+i);
(p + i) = (p + i + 1);
*(p + i + 1) = temp;
swap = true;
}
}
} while (swap);
return p;
}
void showArray(const int array[], int size)
{
for (int count=0;count
cout << array[count] <<" ";
}
cout << endl;
}