I\'ve created this program. it compiles and runs and everything works well excep
ID: 3555010 • Letter: I
Question
I've created this program. it compiles and runs and everything works well except for one thing. My problem is that when the player holds or gets a 1 his scores resets to 0 instead of keeping his old scores and starting back at the same score he was before. The rules are the following :
The game of Pig is a simple two player dice game in which the first player to reach 100 or more points wins. Players take turns. On each turn a player rolls a six-sided die. After each roll:
? If the player rolls 2
Explanation / Answer
#include #include #include using std::cout; using std::cin; using std::endl; int dieRoll(); int humanTurn(int); int computerTurn(int); int main() { int humanTotalScore = 0, computerTotalScore = 0; srand(time(NULL)); //set a different seed for rand() every time to get different game outputs //loop to keep playing until someone scores 100+ do { humanTotalScore = humanTotalScore + humanTurn(humanTotalScore); //add the score from a new turn to the running total coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.