📜  求和数组 c++ 代码示例

📅  最后修改于: 2022-03-11 14:44:55.765000             🧑  作者: Mango

代码示例1
array a{1,2,3,4,5,6,7,8,9};
  int sum = 0;
//Method 1:
  sum = accumulatea(a.begin(), a.end(), 0);
//Method 2: 
  for(auto& i : a) sum+=i;