// Looping it 4 times because we need to input 4 characters
for (int m = 0; m < 4; m++)
{
if (guesser[m] > 91) // lower case level
guesser[m] = guesser[m] - 32;
}
}
// Function 3 is how many right at position and how many right but at wrong spot.
// Two arrays. One is my loving guesser from before and another is right which che kts right spots.
// It is bool because we need to check the true and false for the colors and positions.
bool right_guesses_displayer(char guesser[], char check_right[])
{
int rightcolour=0;
int completeright=0;
int count;
bool variable1[4];
bool variable2[4];
bool variable3=false;
for (int m=0; m < 4 ; m++) // I want to access the values of my array from 0 to 1 using this loop.
{
variable1 [m]= false;
variable2 [m] =false;
}
// My loop which determines the colors in exact position
for (int m = 0; m < 4; m++)
{
if (guesser[m] == check_right[m])
{
rightcolour++;
variable1[m] = true;
}
}
// Following nested loops determine the colors right but in wrong place
for (int m=0 ; m < 4; m++)
{
if (!variable1[m])
{
for (int k = 0; k < 4; k++)
{
if (!variable1[k] && m != k)
{
if ((guesser[m] == check_right[k]) && !variable2[k])
{
variable3 = true;
count = k;
}
}
}
}
}
}
// ******************************************** Function Declaration ends********************************************
int main()
{
cout << endl;
// generate the correct random sequence
srand(time(0));
for (int m = 0; m < 4; m++)
{
int temp = (rand() % 6) + 1;
}
cout << endl;
// loop until the user gets the right value
while (!won && numGuesses > 0)
{
guess_inputer(guess, numGuesses);
won = right_guesses_displayer(guess, right);
numGuesses--;
}
Is the problem you are having that no matter what, the second guess is always a 'Correct' answer, despite it being any order or even random letters? Or are there any other problems you want to point out?