EDIT: Sorry didn't see it said not the most effective/efficient way.For better automation you should make it so you don't have to specify the number of times to loop through.
Your Code: [inline=c++]for (int m = 0; m < 5; m++) {[/inline] or anywhere else that the number 5 shows up.
You should put something like this:[inline=c++]for (int m = 0; m < sizeof(array1)/sizeof(int); m++) {[/inline]
This makes your code much easier to reuse and will work if you don't know how long the length is.
Everything else is pretty good!
