Answers for "c++ program how to let the user choose different game modes"

C++
0

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;
}
Posted by: Guest on March-19-2020

Code answers related to "c++ program how to let the user choose different game modes"

Browse Popular Code Answers by Language