1] 授業単元:
[2] 問題文(含コード&リンク):
list<int> 型の要素全ての和を求める関数 int sumlist(list<int>&) を定義して下さい.
#include <iostream>
#include <list>
using namespace std;
int main(){
list<int> lst;
for(int i=0 ; i < 10 ; i++)lst.push_back(i);
cout << "size =" << lst.size() << endl;
for(list<int>::iterator it = lst.begin(); it != lst.end() ; ++it)
cout << *it << ' ';
cout << endl;

for(list<int>::iterator it = lst.begin(); it != lst.end() ;){
if((*it) % 3 == 0){
it = lst.erase(it);
}
else {
++it; } }
for(list<int>::iterator it = lst.begin(); it != lst.end() ; ++it)
cout << *it << ' ';
cout << endl;
return 0;}
[3] 環境
 [3.1] OS: XP
 [3.2] コンパイラ名とバージョン: マイクロソフトビジュアルスタジオ
 [3.3] 言語: C++
[4] 期限: 1月23日
[5] その他の制限: