C++: Enregistrer les données transformées dans un ‘deque’

Author:

 deque
{filelink=15007}

#include 
#include 
#include 
#include 
#include 
#include 

using namespace std;

int main ()
{
    vector  v1, v2;
    for (int num = 0; num < 10; ++ num){
        v1.push_back (num);
        v2.push_back (10 - num);
    }

    deque  deq (v1.size ());

    transform ( v1.begin (), v1.end (), v2.begin (), deq.begin (), plus  () );

    for (size_t index = 0; index < v1.size (); ++ index)
	{
        cout << index << "    	 " << v1 [index];
        cout << v2 [index]  << " 	  =    ";
        cout << deq [index] << endl;
    }

    return 0;
}

Leave a Reply

Your email address will not be published. Required fields are marked *