vector assignment : vector compare « vector « C++ Tutorial






#include <iostream>
using std::cout;
using std::cin;
using std::endl;

#include <iomanip>
using std::setw;

#include <vector>
using std::vector;

int main()
{
   vector< int > integers1( 7 ); // 7-element vector< int >
   vector< int > integers2( 10 ); // 10-element vector< int >

   size_t i;
   
   for ( i = 0; i < integers1.size(); i++ ){
      cout << integers1[ i ];
   }
   for ( i = 0; i < integers2.size(); i++ ){
      cout << integers2[ i ];
   }

   cout << "\nAssigning integers2 to integers1:" << endl;
   integers1 = integers2; // integers1 is larger than integers2

   // use equality (==) operator with vector objects
   if ( integers1 == integers2 )
      cout << "integers1 and integers2 are equal" << endl;


   return 0;
}
00000000000000000
Assigning integers2 to integers1:
integers1 and integers2 are equal








16.9.vector compare
16.9.1.Compare two vectors: !=
16.9.2.compare two vector
16.9.3.vector assignment