Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- bool isEqual(const int list1[], const int list2[], int size)
- {
- bool result=true;
- for(int c=0; c<size; c++)
- {
- if(list1[c]!=list2[c])
- result=false;
- }
- return(result);
- }
- int main()
- {
- int sizeofarray;
- cout<<"Enter size of array: ";
- cin>>sizeofarray;
- int list1[sizeofarray], list2[sizeofarray];
- cout<<"\nEnter the first list, one integer per line:\n";
- for(int i=0; i<sizeofarray; i++)
- {
- cout<<(i+1)<<": ";
- cin>>list1[i];
- }
- cout<<"\nEnter the second list, one integer per line:\n";
- for(int j=0; j<sizeofarray; j++)
- {
- cout<<(j+1)<<": ";
- cin>>list2[j];
- }
- if(isEqual(list1, list2, sizeofarray))
- cout<<"\nThe two arrays are identical.\n";
- else
- cout<<"\nThe two arrays are not identical.\n";
- return(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement