I'm having trouble determining what in my code is causing the message "Program.exe has stopped working." It displays the results properly, otherwise. Any suggestions?
#include <iostream>
using namespace std;
int main()
{
const int numArraySize = 11;
int numArray[] = {1, 2, 3, 3, 3, 2, 2, 1, 3, 4, 5};
const int dupSize = 6;
int dupArray[dupSize];
int *frequency;
int counter;
int displacement;
int mode = 0;
for (counter=0; counter < numArraySize; counter++)
{
dupArray[counter] = 0;
frequency = dupArray;
}
for (counter = 0; counter < numArraySize; counter++)
{
displacement = *(numArray+counter);
(*(frequency+displacement))++;
}
int highest = *frequency;
for (counter = 1; counter < dupSize; counter++)
{
if (*(frequency + counter) > highest)
{
highest = *(frequency + counter);
mode =+ counter;
}
}
if (highest > 1)
cout << "The mode of the array is " << mode << "." << endl;
else
cout << "There is no mode." << endl;
return 0;