标签:owa for names swa using oid namespace prototype temp
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 <<array<< endl;
return 0;
}
int selectSort(int p,int size)
{
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<size;count++)
{
cout << array[count] <<" ";
}
cout << endl;
}
标签:owa for names swa using oid namespace prototype temp
原文地址:https://www.cnblogs.com/131415-520/p/11722079.html