前田稔(Maeda Minoru)の超初心者のプログラム入門
![]()
![]()
/*★ Algorithm Step1 前田 稔 ★*/
#include <iostream>
#include <vector>
using namespace std;
void main()
{
int t[] = { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
vector<int> v(t, t+10);
// vector v を表示
cout << "vector v ";
disp(v);
}
|
template<class Container>
void
disp(const Container& c)
{
for(Container::const_iterator first=c.begin(); first!=c.end(); first++)
//★cellのデータを印字して下さい。
cout << endl;
}
|
![]()
int t[] = { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
list<int> lst(t,t+10);
// list lst[] を表示
cout << "list lst ";
disp(lst);
|
int a[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
// int a[] を表示
cout << "a[] ";
disp(a);
|
![]()