// This program creates a simulated player who takes one turn in the // Pig dice…

// This program creates a simulated player who takes one turn in
the
// Pig dice game. The simulated player keeps rolling the die
until
// the total for the turn is 20 or greater, or until a 1 is
rolled.
// If a 1 is rolled, the player’s score for the turn is 0.
Otherwise
// the player’s score is the sum of the rolls for the turn.
//
/////////////////////////////////////////////////////////////////////

Place Order

#include<iostream>
#include<cstdlib>
#include<time.h>

using namespace std;

int randNumGen(int upper, int lower);   // function
prototype

int main()
{
int roll; // The value of the die roll
int total_turn = 0; // Player’s score for this turn

// Seed the random number generator
srand(static_cast<int> (time(NULL)));

  
/////////////////////////////////////////
// Start of your code

  
// Use a while loop to roll the die until the total turn number
is
// 20 or greater, or until a 1 is rolled. if a 1 is rolled
the
// player gets a 0 for the turn.
// Call function randNumGen() to generate a number within the range
1..6

   // to simulate the rolling of the die
  
  
  
  
  
  
//output the number of points the simulated player got for the
turn.

  
// End of your code
/////////////////////////////////////////

system(“pause”);
return 0;

}//close main()

// function definition
int randNumGen(int upper, int lower)   // function
heading
{          
           
           
    // function body
   return (rand() % (upper – lower + 1)) + lower;
}