// 0918.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include <list> #include <deque> #include <iostream> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { list<int> ilist; deque<int> odd_deque, even_deque; int ival; cout << "enter integer numbers:" << endl; while (cin >> ival) ilist.push_back(ival); cout << "elements in list:" << endl; for ( list<int>::iterator iter = ilist.begin();iter!=ilist.end();iter++ ){ cout << *iter << " "; if (*iter % 2 ==0) even_deque.push_back(*iter); else odd_deque.push_back(*iter); } cout << endl << "elements in odd_deque:" << endl; for ( deque<int>::iterator iter = odd_deque.begin();iter!=odd_deque.end();iter++ ) cout << *iter << " "; cout<< endl << "elements in even_deque:" << endl; for ( deque<int>::iterator iter = even_deque.begin();iter!=even_deque.end();iter++ ) cout << *iter << " "; return 0; }