I Can't Increment my try number.Can anyone pleass help out?

Can anyone pls help out.
I can’t increment my try number…

my code…

main.cpp
#include
#include
#include"FBullCowGame.h"

using Ftext = std::string;
using int32 = int;

void Printintro();
Ftext GetValidGuess();
void playgame();
bool AskToPlayAgain();

FBullCowGame BCGame;//instatiate a new game

//entry point for application
int32 main()
{

bool WantsToPlayAgain = false;
do
{
	Printintro();
	playgame();
	WantsToPlayAgain = AskToPlayAgain();
} while (WantsToPlayAgain);

return 0; //exit application

}

//introduce the game
void Printintro()
{
std::cout << “Welcome to bulls and cows” << std::endl;
std::cout << “can u guess the " << BCGame.HiddenWordLength() ;
std::cout << " letter isogram I’m thinking of\n”;
std::cout << std::endl;
return;
}

//get a guess
Ftext GetValidGuess()
{
EGuessStatus Status = EGuessStatus::Invalid_Status;
do {
//get a guess from the player
int32 CurrentGuess=BCGame.GetCurrentTry();
std::cout << "Try " << CurrentGuess;
std::cout << ".Enter a guess = ";
Ftext Guess = “”;
std::getline(std::cin, Guess);

//check status and give feedback
Status = BCGame.CheckGuessValidity(Guess);
switch (Status)
{
case EGuessStatus::Wrong_length:
	std::cout << "Please enter a " << BCGame.HiddenWordLength() << " letter word.\n";
	break;
case EGuessStatus::Not_Isogram:
	std::cout << "Please enter an isogram. \n";
	break;
case EGuessStatus::Not_LowerCase:
	std::cout << "Please enter the guess in lowercase. \n";
	break;
default:
	return Guess;
     }

} while (Status != EGuessStatus::OK);
std::cout << std::endl;

}

//loop to guess and printing it 5 times
void playgame()
{
FBullCowGame BCGame;
int32 MaxTries = BCGame.GetMaxTries() ;
for (int32 count = 1; count <= MaxTries; count++)
{
Ftext Guess = GetValidGuess();

	EGuessStatus Status = BCGame.CheckGuessValidity(Guess);

	//submit valid guess to game and receives count
	FBullCowCount BullCowCount=BCGame.SubmitGuess(Guess);
	std::cout << "Bulls= " << BullCowCount.Bull<<std::endl;
	std::cout << "Cows=  " << BullCowCount.Cow << std::endl;
	
}

}

bool AskToPlayAgain()
{
std::cout << “Do You Want To Play Again (y/n)?”;
Ftext Response = “”;
std::getline(std::cin, Response);

return (Response[0] == 'y') || (Response[0]=='Y');

}

FBullCowgame.cpp

#include “FBullCowGame.h”
using Fstring = std::string;
using int32 = int;

FBullCowGame::FBullCowGame() //constructor
{
Reset();
}

void FBullCowGame::Reset()
{
constexpr int32 MAX_TRIES = 8;
const Fstring HIDDEN_WORD = “Planet”;
MyHiddenWord = HIDDEN_WORD;
Mycurrenttry = 1;
MyMaxTries = MAX_TRIES;
return;
}

int32 FBullCowGame::GetMaxTries() const
{
return MyMaxTries;
}

int32 FBullCowGame::GetCurrentTry() const
{
return Mycurrenttry ;
}

bool FBullCowGame::IsTheGameWon() const
{
return false;
}

int32 FBullCowGame::HiddenWordLength() const
{

return MyHiddenWord.length();

}

EGuessStatus FBullCowGame::CheckGuessValidity(Fstring Guess) const
{
if (false) // if guess is not an isogram
{
return EGuessStatus::Not_Isogram;
}

else if (false)			//if guess is not lowercase
{
	return EGuessStatus::Not_LowerCase;

}

else if (Guess.length() != HiddenWordLength())           //if guess length is wrong
{
	return EGuessStatus::Wrong_length;
}

else 
{
	return EGuessStatus::OK;
}

}

FBullCowCount FBullCowGame::SubmitGuess(Fstring Guess)
{
//increment the turn number
Mycurrenttry++;

//setup a return variable
FBullCowCount BullCowCount;

//loop through all letters in the variable
int32 HiddenWordLength = MyHiddenWord.length();
for (int32 MHWChar = 0; MHWChar < HiddenWordLength; MHWChar++) {
	//compare letters against hidden word
	for (int32 GWChar = 0; GWChar < HiddenWordLength; GWChar++
		) {

		//if they match
		if (Guess[GWChar] == MyHiddenWord[MHWChar]) {
			//if they are in same place
			if (MHWChar == GWChar) {
				BullCowCount.Bull++;//increment bulls
			}
			else {
				BullCowCount.Cow++;//else increment bulls
			}


		}
	}
}

return BullCowCount;

}

FBullCowGame.h

#pragma once
#include
using Fstring = std::string;
using int32 = int;

struct FBullCowCount
{
int32 Bull = 0;
int32 Cow = 0;
};

enum EGuessStatus {

Invalid_Status,
OK,
Not_Isogram,
Wrong_length,
Not_LowerCase

};

class FBullCowGame {
public:
FBullCowGame(); //constructor
int32 GetMaxTries() const;
int32 GetCurrentTry()const;
bool IsTheGameWon()const;
int32 HiddenWordLength()const;
EGuessStatus CheckGuessValidity(Fstring) const;//TODO more richer return value

void Reset(); //TODO make more richer return value 

FBullCowCount SubmitGuess(Fstring Guess);// counts bulls andcows and increases try #

private:
int32 Mycurrenttry;
int32 MyMaxTries;
Fstring MyHiddenWord;
};

Privacy & Terms