CJCoding With Joseph
15free / daySign inCreate account

Compare Two Arrays

Write 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 — print one after the last line.

Hints2 available
Topics:
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.