int my_accumulate(const int *first, const int *last)
{
int sum = 0; // 合計値を0に初期化しておく
while( first != last ) { // 処理範囲の間ループ
sum += *first++; // データを合計値に加算
}
return sum; // 合計値を返す
}
解説:
前: | 次: