blob: 4eb9b9ed94a7ca86253939d0772c0d4242196101 (
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
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#include <iostream>
#include <vector>
#include <iterator>
#include "sales_data.hpp"
#include "sales_item.hpp"
/*
*
* 3.36
*
*
*/
int main () {
constexpr size_t ArrSize = 5;
int arr1[ArrSize];
int arr2[ArrSize];
std::cout << "Input " << ArrSize << " numbers: " << std::endl;
for(auto &a : arr1) {
if(std::cin >> a) {} else { return -1; }
}
std::cout << "Input " << ArrSize << " numbers: " << std::endl;
for(auto &a : arr2) {
if(std::cin >> a) {} else { return -1; }
}
bool f = true;
for(size_t ii = 0 ; ii != ArrSize ; ++ii) {
if(arr1[ii] != arr2[ii]) {
std::cout << "The arrays are not equal." << std::endl;
f = false;
break;
}
}
if(f == true) {
std::cout << "The arrays are equal." << std::endl;
}
int a = 0;
std::vector<int> vec1;
std::vector<int> vec2;
std::cout << "Input " << ArrSize << " numbers: " << std::endl;
for(decltype(vec1.size()) i = 0 ; i != ArrSize ; ++i) {
if(std::cin >> a) {} else { break; }
vec1.push_back(a);
}
std::cout << "Input " << ArrSize << " numbers: " << std::endl;
for(decltype(vec2.size()) i = 0 ; i != ArrSize ; ++i) {
if(std::cin >> a) {} else { break; }
vec2.push_back(a);
}
if(vec1 != vec2) {
std::cout << "The vectors are not equal." << std::endl;
return 0;
} else if (vec1 == vec2) {
std::cout << "The vectors are equal." << std::endl;
}
return 0;
}
|