Mega Code Archive

 
Categories / C++ Tutorial / Vector
 

Compare two vector

#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); }