编写一个模块函数fill

给数组a[start:end-1]赋值value。

官方答案:

template <class T>
void fill(T* a, int start, int end, const T& value)
{// Set a[start:end-1].
   for (int i = start; i < end; i++)
      a[i] = value;
}

 

posted @ 2017-08-30 13:23  御风少爷  阅读(387)  评论(0编辑  收藏  举报