In the SubmitGuess function itself; it resets the value.
FBullCowCount FBullCowGame::SubmitGuess(Fstring)
{
// set up a return variable
FBullCowCount BullCowCount;
return BullCowCount;
}
//set up a return variable we created a new Struct called “BullCowCount.”
The answer is that when the function ends; after returning the information back to your main.cpp struct; you no longer have the created “BullCowCount” inside of the Submit function. It is a little confusing; because in the lecture the same name is given to the struct in your main.cpp file- but these are not the same.
So as your run the loop in main.cpp; it re-creates the ‘BullCowCount’ struct which is initiialized as:
struct FBullCowCount
{
int32 Bulls = 0;
int32 Cows = 0;
};
in your header file.
Great question; made me think of why this is happening! Hope this helps.