/*************************************************************************
> File Name: 3_36_1.cpp
> Author:
> Mail:
> Created Time: Wed 12 Apr 2017 09:12:02 PM CST
************************************************************************/
#include<iostream>
#include<vector>
#include<random>
using namespace std;
int main()
{
int arrone[10];
int arrtwo[10];
random_device rd;
for(int i = 0; i < 10; ++i)
{
arrone[i] = rd() % 100;
arrtwo[i] = rd() % 100;
}
for(auto i : arrone)
cout<<i<<" ";
cout<<endl;
for(auto i : arrtwo)
cout<<i<<" ";
cout<<endl;
for(int i = 0; i < 10; ++i)
{
if(arrone[i] != arrtwo[i])
{
cout<<"not equal!"<<endl;
return 0;
}
}
cout<<"equal!"<<endl;
return 0;
}
/*************************************************************************
> File Name: 3_36_2.cpp
> Author:
> Mail:
> Created Time: Wed 12 Apr 2017 09:20:24 PM CST
************************************************************************/
#include<iostream>
#include<vector>
#include<random>
using namespace std;
int main()
{
random_device rd;
vector<int> ivecone,ivectwo;
for(int i = 0,temp; i < 10; ++i)
{
temp = rd() % 100;
ivecone.push_back(temp);
ivectwo.push_back(temp);
}
for(auto i : ivecone)
cout<<i<<" ";
cout<<endl;
for(auto i : ivectwo)
cout<<i<<" ";
cout<<endl;
for(auto it_one = ivecone.begin(),it_two = ivectwo.begin();
it_one != ivecone.end() && it_two != ivectwo.end();
++it_one,++it_two)
{
if(*it_one != *it_two)
{
cout<<"not equal!"<<endl;
return 0;
}
}
cout<<"equal"<<endl;
return 0;
}
转载于:https://www.cnblogs.com/tolic/p/7142228.html