You do this in the global scope: int *nContestants = newint[nNumberOfContestants];
I wasn't aware that this was legal, but it would be done before any code. Since, at this time, nNumberOfContestants is 0, you have an array of size 0. What you should do is move this line down to line 24 (right after you write to: nNumberOfContestants).
The second issue is that you do this: for(int iii = 0; iii <= nNumberOfContestants; iii++)
but it should be for(int iii = 0; iii < nNumberOfContestants; iii++)
Let's say you have an array of 4. You can access m_array, m_array, m_array, m_array. If you try and access m_array, then you're accessing memory which is not meant for you. This will often even cause the crashes.