プログラミング道場 ACM/ICPC

塗りつぶし

最終更新:

kit

- view
だれでも歓迎! 編集
/*
	template<class _FwdIt, class _Ty>
	void fill(_FwdIt _First, _FwdIt _Last, const _Ty& _Val)

	template<class _OutIt, class _Diff,	class _Ty>
	void fill_n(_OutIt _First, _Diff _Count, const _Ty& _Val)
*/

#include <algorithm>
#include <iostream>

using namespace std;

int main()
{
	int a[5];

	// 0,0,0,0,0,
	fill( a, a+5, 0 );
	copy( a, a+5, ostream_iterator<int>(cout,",") );

	// 1,1,1,1,1, 
	fill_n( a, 5, 1 );
	copy( a, a+5, ostream_iterator<int>(cout,",") );
 
	return 0;
}

タグ:

+ タグ編集
  • タグ:

このサイトはreCAPTCHAによって保護されており、Googleの プライバシーポリシー利用規約 が適用されます。

目安箱バナー