blob: 0ddc0e4c6174c84166a3addbb36107f9977690fa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#include <iostream>
#include <vector>
#include <list>
/*
*
* 9.16
*
*
*/
int main () {
std::vector<int> v1;
std::list<int> v2;
int in = 0;
std::cout << "v1" << std::endl;
for(int i = 0 ; i < 10 ; ++i) {
if(std::cin >> in) {} else {
std::cout << "Error: Wrong input." << std::endl;
return -1;
}
v1.push_back(in);
}
std::cout << "v2" << std::endl;
for(int i = 0 ; i < 10 ; ++i) {
if(std::cin >> in) {} else {
std::cout << "Error: Wrong input." << std::endl;
return -1;
}
v2.push_back(in);
}
bool iseq = true;
auto v1beg = v1.cbegin();
auto v2beg = v2.cbegin();
for( ; v1beg != v1.cend() && v2beg != v2.cend() ; ++v1beg, ++v2beg) {
if(*v1beg != *v2beg) {
iseq = false;
break;
}
}
if(iseq == true) {
std::cout << "equal!" << std::endl;
}
return 0;
}
|