int my_count(const int *first, const int *last, int value)
{
int count = 0; // 個数をカウントする変数を宣言し、0 に初期化
while( first != last ) { // 処理範囲の間ループ
if( *first++ == value ) // value を発見したら
++count; // カウンタをインクリメント
}
return count; // カウンタの値を返す
}
解説:
前: | 次: