Last active
January 27, 2016 19:06
-
-
Save JackDraak/d7d6bbf4ad4cae02bff1 to your computer and use it in GitHub Desktop.
excerpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// making my best effort, I think these code changes can get you the output you're looking for: | |
// | |
// there are 2 problems with the code. | |
// The first happens on line 34 where you execute the PLayerGetGuess function (getting input) but don't store the value. | |
// to fix that problem, replace line 34 with: | |
std::string PlayerGuess = PlayerGuessGet(); // store the PlayerGuess acquired by the PlayerGetGuess() function | |
// becuse you're intializing and storing this variable inside the PlayGame function, it is inaccessible outside the function, so... | |
// next, on line 35 you execute a function intended to print the PLayerGuess back to the console. | |
// This is a bigger change, but you can make it work with these changes | |
// replace line 35 with: | |
PlayerGuessReturn(PlayerGuess); // pass the private variable to another function | |
// replace line 11 with: | |
void PlayerGuessReturn (std::string); // declare that the function requires a string argument | |
// delete line 49 - we do NOT want to call the Setter from the Getter | |
// and finally replace line 47 with: | |
void PlayerGuessReturn(PlayerGuessValue) // assign PlayerGuessValue the string passed to it | |
// Note: PlayerGuessValue is also a private variable of this function, and is not visible outside of the function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
TL;DR :
replace line 11 in your Main.cpp with line 17 above
replace line 34 line 7 from above Gist
replace line 35 with line 14 from Gist
replace line 47 with line 21 from Gist
delete line 49 of your Main.cpp