this is my main after this lecture I’ve been wondering if there is any potential side effects ?
main()
{
PrintIntro();
do {
cout << endl;
PlayGame();
} while (AskToPlayAgain());
return 0; //exit the application
}
this is my main after this lecture I’ve been wondering if there is any potential side effects ?
main()
{
PrintIntro();
do {
cout << endl;
PlayGame();
} while (AskToPlayAgain());
return 0; //exit the application
}
Not sure what you mean by side effects?
Looks fine to me.
If you mean any side affects to ‘cout << endl;’ at the beginning of every game loop, the short answer is no (other than the new line that’s created).
Long answer is, it will depend on how your PlayGame function ends and starts. If PlayGame starts or ends with creating a new line then you might find that you have too much spacing.
More importantly PlayGame will end in a Win or Lose state, if they aren’t consistent then you might get some odd spacing that could be missed while testing.
Just be aware of it and you may find that you want to move it somewhere else the more you develop the game.
hoo thank god it’s Looks fine to you
it’s about using the method inside while
rather than taking the result in a variable
thank you very much I didn’t consider that
but my point was about using the method inside while
rather than taking the result in a variable
Yeah, that’s perfectly fine since the function is returning a boolean value which the while( … ) is expecting.
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.