(1):# include <iostream>
using namespace std
(2)include<ctime>:計算程序運行時間需包含;
(3)#include<stdlib.h>:使用malloc()時需包含;
(4)#include<algorithm>:使用sort()時需包含;
(5)#include<vector>:使用 向量時需包含;
(1):# include <iostream>
using namespace std
(2)include<ctime>:計算程序運行時間需包含;
(3)#include<stdlib.h>:使用malloc()時需包含;
(4)#include<algorithm>:使用sort()時需包含;
(5)#include<vector>:使用 向量時需包含;
數組求和 方法一:直接一次for循環 int GetSum1(int *a,int n) { int sum=0; for (int i=0; i<n;i++) { sum+=a[i];