Hola, im following a tutorial on how to make the bulls and cows game, its my first time using classes and I need a little help.
Im having trouble with the reset function, it doesnt seem to work, it seems as the current try is equal to the max tries so each time i run the program, the game finishes. I tried it without the reset and it works fine.
#pragma once
#include <string>
class FBullCowGame
{
public:
FBullCowGame();
void Reset();
int GetMaxTries() const;
int GetCurrentTry() const;
bool IsGameWon() const;
bool CheckGuessValidity(std::string);
private:
int MyMaxTries;
int MyCurrentTry;
};
With the code you currently have, I can't see the problem, however, do not use #pragma once, instead of normal header guards. Pragma isn't supported by all compilers, but when an unsupporting compiler sees a pragma statement, it won't throw a syntax error and your program will run, leading to headers being included more than once in the same file.