String Guess = GetGuess();

What is the difference between assigning that function(its return value) to a variable then printing it out v.s just printing out that function directly?

string Guess = GetGuess();
cout << "Your guess was: " << Guess<< endl;

v.s

cout << "Your guess was: " << GetGuess() << endl;

In that situation skipping the variable assignment would be better. You would not have the value entered stored for later use, which is what presumably be what you would want.

Privacy & Terms