I wrote a program (with some help from a C++ book) to roll a6-sided dice. I was
ID: 3612754 • Letter: I
Question
I wrote a program (with some help from a C++ book) to roll a6-sided dice. I was trying to alter the program to allow meto choose the number of sides on the die (ie, 6, 8, 10, etc) andhow many times it would be rolled (ie 1, 2, 3), but I had noluck. Below is what I wrote for a single 6-sided. Ineed help in altering it.// Die Roller
// Demonstrates generating random numbers
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main()
{
srand(time(0)); // seed randomnumber generator based on current time
int randomNumber = rand(); //generaterandom number
int die = (randomNumber % 6) +1; // get a numberbetween 1 and 6
cout << "You rolled a " << die<< endl;
system("pause");
return 0;
}