Compare Two Arrays
mediumQuestion 545Write a function bool sameContents(const array<int, 4>& a, const array<int, 4>& b) that returns true when the two arrays hold the same values in the same order and false otherwise.
The test prints the word same when your function returns true and different when it returns false, one result per line. For {1, 2, 3, 4} compared with {1, 2, 3, 4} it prints the output shown in Expected Output.
Do NOT write a main function.
Expected output
same different different
= newline. The output ends with a newline, so print one after the last line.
Hints2 available
Sign in to use hintsTopics
STL Containersstd::array
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)
Your output
Run your code to see the output here...
Test cases
Run your code to see test case results.