Remove the side-effect GetGuessAndPrintBack Challenge

So like I was shown before, I decided to extract the “print the guess back to them” part of the code block as a separate function and this is what it did:

I understand why it put std:: to access the standard namespaces, just that vs did not realise I have a using namespace line at the top of my code, so I am able to get rid of that part of the code at this point. However I don’t understand a few things:

  1. Why has visual studio put const before string?
  2. Why is there & signs there? (If I remove them, vs does not know what I am talking about and will not recognise the program or batch file if I don’t have those). It’s got it there next to the name of my function “PrintBack()”
  3. Why has it also has put the string Guess as a parameter? Is that so it can access the value of Guess in the previous function?

Thanks!

Privacy & Terms