compare two vector : vector compare « vector « C++ Tutorial






#include <vector>
#include <iostream>
using namespace std;

int main(int argc, char** argv)
{
  vector<int> v1(10, 0);
  vector<int> v2(10, 0);

  if (v1 == v2) {
    cout << "equal!\n";
  } else {
    cout << "not equal!\n";
  }

  v1[3] = 50;

  if (v1 < v2) {
    cout << "v1 is less than v2\n";
  } else {
    cout << "v1 is not less than v2\n";
  }
  return (0);
}








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