![]() |
#2
rjsp2013-03-07 08:29
|

#include<iostream>
#include<vector>
using namespace::std;
int main(){
vector<int>vec1,vec2;
int i,mincn;
cout<<"Enter some numbers"<<endl;
while(cin>>i){
vec1.push_back(i);
}
cout<<"Enter some numvers again."<<endl;
while(cin>>i){
vec2.push_back(i);
}
if(vec1.size()>vec2.size()){
mincn=vec2.size();
}else{
mincn=vec1.size();
}
for(vector<int>::size_type ix=0;ix!=mincn;++ix){
if(vec1[ix]==vec2[ix]){
cout<<"true"<<endl;
}else{
cout <<"wrong"<<endl;
}
}
return 0;
}
#include<vector>
using namespace::std;
int main(){
vector<int>vec1,vec2;
int i,mincn;
cout<<"Enter some numbers"<<endl;
while(cin>>i){
vec1.push_back(i);
}
cout<<"Enter some numvers again."<<endl;
while(cin>>i){
vec2.push_back(i);
}
if(vec1.size()>vec2.size()){
mincn=vec2.size();
}else{
mincn=vec1.size();
}
for(vector<int>::size_type ix=0;ix!=mincn;++ix){
if(vec1[ix]==vec2[ix]){
cout<<"true"<<endl;
}else{
cout <<"wrong"<<endl;
}
}
return 0;
}
可以读入第一组数据 ,,,,第二组数据该如何写入