Windows did something

I used the windows “Extract Function command” and it did something that is weird and confusing

string GetGuessAndPrintBack()
{
	// get a guess from the player
	cout << "Enter your guess: ";
	string Guess = "";
	getline(cin, Guess);

	return RepeatGuess(Guess);
}

const std::string &RepeatGuess(std::string &Guess)
{
	// print the guess back
	cout << "Your guess was: " << Guess << endl;
	return Guess;
}

I dont know what it does but it works

I’m going to guess that your most confused by the ‘&’ in the function name and parameter. You can do some research on Pointers that might help you understand this easier.

Privacy & Terms