vector<int>vec1,vec2; int ival; cout<<"Ender numbers for vector1(-1 to end):"<<endl; cin>>ival; while (ival!=-1) { vec1.push_back(ival); cin>>ival; } cout<<"Ender numbers for vector2(-1 to end):"<<endl; cin>>ival; while (ival!=-1) { vec2.push_back(ival); cin>>ival; } if (vec1.size()!=vec2.size()) { cout<<"不相等"<<endl; } else{ vector<int>::iterator ite1,ite2; for (ite1=vec1.begin(),ite2=vec2.begin(); ite1!=vec1.end(),ite2!=vec2.end(); ++ite1,++ite2) { if (*ite1==*ite2) { cout<<"相等"<<endl; } } }