数组求大小:

int size = sizeof(arr) / sizeof(arr[0]);

静态排序

  1. #include <iostream>
  2. #include <algorithm>
  3. using namespace std;
  4. // SymoChan <hnai@qq.com>
  5. long long arr[] = {6,11,9,14,2,42,21,14,51,4,14,15};
  6. int main() {
  7. cout << endl << "排序前:";
  8. for(auto x : arr) cout << x << " ";
  9. cout << "\narr:" << arr << endl;
  10. int size = sizeof(arr) / sizeof(arr[0]);
  11. cout << "\nsize:" << size;
  12. sort(arr,arr + 10); //排序
  13. cout << endl << "排序后:";
  14. for(auto x : arr) cout << x << " ";
  15. return 0;
  16. }