c++ program how to let the user choose different game modes code example
Example: c++ program how to let the user choose different game modes
int getMode(int *virus, int *frequency, int numVir)
{
int count = 0,
index = 0,
mode = 0,
frLow = 0,
total = 0;
for (index = 0; index < numVir; index++)
{
count = 1;
while (*(virus + index) == *(virus + index + 1))
{
++count;
++index;
}
*(frequency + index) = count;
if (*(frequency + index) > frLow)
{
frLow = *(frequency + index);
total += *(frequency + index);
mode = *(virus + index);
}
else if (frLow == 1 || frLow == *(frequency + index))
{
return -1;
}
}
return mode;
}