1) Write a program which simulates the rolling of pair of 6-sided dice and computes the % occurrence of
a specific dice roll value ranging from 2-12.
2) modify the dice class to keep track of the number of times a die has been rolled, Add a private state
variable called myRollCount and add a new member function called numrolls() which returns the times
the die has been rolled since it was instantiated. After computing the % occurrence of a dice roll, print
out number of times rolled.
results should be example:
2 <<<<<35/1000 <<<<<3.5%
3<<<<< 51/1000<<<<< 5.1%
till 12
Here is my codes
#include <iostream>
#include <E:\dicetry2\dicetry2\dice2.h>
using namespace std;
int main()
{
dice die1(6), die2(6);
int loop = 0;
int counter = 2;
int sum = 0;
double percent = 0;
double solve = 0;
while (counter <= 12)
{
for(loop=1; loop <=1000; loop++)
{
sum = die1.roll() + die2.roll();
int dice::roll()
{
return (rand () %mySides)+1;// creates number between 1 and 6
}
int dice::rollings()
{
myRollCount++;
return myRollCount;
}
int dice::numrolls()
{
return myRollCount;
}
int dice::numSides()
{
return mySides;
}
#endif
i got my results my output IS GOOD. EVERYTHING IS RUNNING.
The thing is i received lots of help doing this i do not know how everything works down to the basics, and i have to present this. Can someone explain this to me in detail , explaining how things work, how the code communicate . how this whole program functions. please so my maybe i can figure it out when i present.