Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- bool areEqual(int length1,int array1[],int length2, int array2[])
- {
- bool flag = false;
- if (length1 != length2)
- {
- return false;
- }
- else
- {
- for (int i = 0; i < length1; i++)
- {
- if (array1[i] != array2[i])
- {
- flag = true; break;
- }
- }
- if (flag == true)
- {
- return false;
- }
- else
- {
- return true;
- }
- }
- }
- int main()
- {
- int array1[10], array2[10];
- int length1, length2;
- cin >> length1;
- for (int i = 0; i < length1; i++)
- {
- cin >> array1[i];
- }
- cin >> length2;
- for (int i = 0; i < length2; i++)
- {
- cin >> array2[i];
- }
- if (areEqual(length1, array1, length2, array2) == false)
- {
- cout << "not equal";
- }
- else
- {
- cout << "equal";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement