c++ how I do a variable to take valors until at a condition code example
Example 1: c++ declare variable
std::string str = "text";
int foo = 3;
float bar = 3.14;
double baz = 3.14159265;
Example 2: 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;
}