65,211
社区成员
发帖
与我相关
我的任务
分享
#include <algorithm>
using namespace std;
int a[10];
//初始化a数组
sort(&(a[0]),&(a[10]));//你没看错,是a[10]!
//好了,收工了……
template<class _RanIt,
class _Pr> inline
void sort(_RanIt _First, _RanIt _Last, _Pr _Pred);
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int a[7] = {23, 1, 33, -20, 6, 6, 9};
sort(a, a+7);
for (int i=0; i<7; i++) {
cout << a[i] << " ";
}
return 0;
}