CHAPTER11-10.cpp
上传用户:fjc899
上传日期:2007-07-03
资源大小:187k
文件大小:1k
- //文件名:CHAPTER11-10.cpp
- #include <vector>
- #include <deque>
- #include <algorithm>
- #include <iostream>
- #include <ostream>
- int main( )
- {
- using namespace std;
- // Assigning random values to vector integer elements
- vector <int> v1 ( 5 );
- vector <int>::iterator Iter1;
- deque <int> deq1 ( 5 );
- deque <int>::iterator d1_Iter;
- generate ( v1.begin ( ), v1.end ( ) , rand );
- cout << "Vector v1 is ( " ;
- for ( Iter1 = v1.begin( ) ; Iter1 != v1.end( ) ; Iter1++ ) cout << *Iter1 << " ";
- cout << ")." << endl;
- // Assigning random values to deque integer elements
- generate ( deq1.begin ( ), deq1.end ( ) , rand );
- cout << "Deque deq1 is ( " ;
- for ( d1_Iter = deq1.begin( ) ; d1_Iter != deq1.end( ) ; d1_Iter++ ) cout << *d1_Iter << " ";
- cout << ")." << endl;
- generate_n ( deq1.begin ( ), 3 , rand );
- cout << "Deque deq1 is ( " ;
- for ( d1_Iter = deq1.begin( ) ; d1_Iter != deq1.end( ) ; d1_Iter++ ) cout << *d1_Iter << " ";
- cout << ")." << endl;
- }