-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path3.36b.cpp
More file actions
51 lines (49 loc) · 1.05 KB
/
3.36b.cpp
File metadata and controls
51 lines (49 loc) · 1.05 KB
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
#include <iostream>
#include <vector>
using std::vector;
using std::cout;
using std::cin;
using std::endl;
int main() {
vector<int> ivec1;
cout << "First vector" << endl;
for (int num = 0; ivec1.size() != 8; ) {
if (cin >> num) {
ivec1.push_back(num);
}
}
vector<int> ivec2;
cout << "Second vector" << endl;
for (int num = 0; ivec2.size() != 8; ) {
if (cin >> num) {
ivec2.push_back(num);
}
}
cout << endl;
for (const int &i : ivec1) {
cout << i << " ";
}
cout << endl;
for (const int &i : ivec2) {
cout << i << " ";
}
cout << endl;
/*
vector<int>::const_iterator p1 = ivec1.begin(), p2 = ivec1.end();
vector<int>::const_iterator p3 = ivec2.begin(), p4 = ivec2.end();
while (p1 != p2 && p3 != p4 && *p1 == *p3) {
++p1;
++p3;
}
if (p1 == p2 && p3 == p4) {
cout << "The two vectors don't differ" << endl;
} else {
cout << "The two vectors differ from each other" << endl;
}
*/
if (ivec1 == ivec2) {
cout << "The two vectors don't differ" << endl;
} else {
cout << "The two vectors differ from each other" << endl;
}
}