Problem

Severity Code Description Project File Line Suppression State
Error C3867 ‘FBullCowGame::GetMaxTries’: non-standard syntax; use ‘&’ to create a pointer to member BullCowGame c:\users\david\onedrive\dokument\unreal projects\section_3\bullcowgame\bullcowgame\main.cpp 27

I get this warning and i honestly dont know what to do.

Could you post your main.cpp? If you put it directly in the post, make sure to use code formatting.

#include
#include
#include “FBullCowGame.h”

void PrintIntro();
void PlayGame();
std::string GetGuess();
bool AskToPlayAgain();

int main()
{
do {
PrintIntro();
PlayGame();

} while (AskToPlayAgain() == true );
	
return 0;

}
//Loop

void PlayGame()
{
FBullCowGame BCGame;
int MaxTries = BCGame.GetMaxTries;
std::cout << MaxTries << std::endl;

for (int count = 1; count <= MaxTries; count++)
{
	std::string Guess = GetGuess();
	
	std::cout << "Your guess was: " << Guess << std::endl;
	std::cout << std::endl;
}

}

void PrintIntro()
{
//Intro
constexpr int WORLD_LENGTH = 9;
std::cout << “Welcome to Bulls and Cows\n”;
std::cout << “can you guess the " << WORLD_LENGTH;
std::cout << " letter isogram i’m thinking of\n”;
std::cout << std::endl;
return;
}

std::string GetGuess()
{
//guess
std::cout << "Write your guess: ";
std::string Guess = “”;
std::getline(std::cin, Guess);

return Guess;

}

bool AskToPlayAgain()
{
std::cout << "Do you want to play again? ";
std::string Response = “”;
std::getline(std::cin, Response);

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

}

Ah, you need the parentheses on GetMaxTries to make it a function call, like this: GetMaxTries()

And in the future, surround the top and bottom of your code with three ` to mark it as code, it makes it much more readable.

Privacy & Terms