Why does my Array assign values into the empty Array?
The "keylist.txt" file simply contains "2 14 74 8 36 4 11"
It clearly is assigned all zeros before I scan my file to get the values for the second array. I have no idea whats going on. Any help would be appreciated.
You only created arrays of 6 elements but your loops are assuming they have 7 elements.
The [6] in int keylist[6] is not the highest index. It's the number of elements. So the indices, which start at 0, can only go up to 5.
Because C++ does not check that you are writing past the end of the array. But doing so is what is called "undefined behavior" and it is a serious error that can seem to work on some systems but not work on others, or possibly create a problem that will show up later on. If you compile your code on gcc with full warnings (-Wall -W -pedantic) it will tell you that you have undefined behavior.