c 2b 2b program how to let the user choose different game modes

Solutions on MaxInterview for c 2b 2b program how to let the user choose different game modes by the best coders in the world

showing results for - "c 2b 2b program how to let the user choose different game modes"
Naya
10 Jun 2017
1int getMode(int *virus, int *frequency, int numVir)
2{
3   int count = 0,
4	   index = 0,
5	   mode = 0,
6	   frLow = 0,
7           total = 0;
8
9   for (index = 0; index < numVir; index++)
10   {
11	  count = 1;
12
13	  while (*(virus + index) == *(virus + index + 1))
14	  {
15		 ++count;
16		 ++index;
17	  }
18	  
19	  *(frequency + index) = count;
20	  
21	  if (*(frequency + index) > frLow)
22	  {
23		 frLow = *(frequency + index);
24                 total += *(frequency + index);
25		 mode = *(virus + index);
26	  }
27
28	  else if (frLow == 1 || frLow == *(frequency + index))
29	  {
30		 return -1;
31	  }
32   }
33
34    return mode;
35}