// Assignment 5 Solution #include #include #include using namespace std; const int GamePoints = 100; int main() { //srand(time(0)); int playerPoints = 0; int turnNumber = 0; int pointTotalForRoll; int die1, die2; int sum; int pointTotalForTurn; while (playerPoints < 100) { cout << "\nThis is your turn #" << ++turnNumber << endl; pointTotalForTurn = 0; for (int i = 1; i <= 3; i++) { die1 = rand() % 6 + 1; die2 = rand() % 6 + 1; if (die1 + die2 == 7) sum = 0; else sum = die1 + die2; pointTotalForRoll = sum; cout << "* You rolled " << die1 << " and " << die2 << ". That's " << sum << endl; if (pointTotalForRoll ==0) break; pointTotalForTurn += pointTotalForRoll; } cout << "** You scored " << pointTotalForTurn << " points for this turn\n"; playerPoints += pointTotalForTurn; cout << "*** Your total is now " << playerPoints << endl; } }