S
shell
A little background regarding what I am doing:
I am supposed to write a small program that simulates rolling dice. I
randomly generated the number like I am supposed to, but then I am
supposed to count the number of times each number occurs(this is my
problem). I am also supposed to print in column for the number, the
max count, the min count, and the average count!!!
Could some one help me!!!
Here is the Code I have so far (I cannot use arrays on this project):
#include <iostream>
#include <stdlib.h>
#include <time.h>
using namespace std;
void dice (int & x, int count);
int main ()
{
int count=0;
int x;
dice(x,count);
}
//-------------------------------
void dice (int & x,int count)
{
do
{
srand((unsigned)time(NULL));
x= (rand () %6+1);
cout<< x;
count++;
}
while (count<0);
{
cout<< x;
}
}
-------------------------------------------------------------------------------
I am supposed to write a small program that simulates rolling dice. I
randomly generated the number like I am supposed to, but then I am
supposed to count the number of times each number occurs(this is my
problem). I am also supposed to print in column for the number, the
max count, the min count, and the average count!!!
Could some one help me!!!
Here is the Code I have so far (I cannot use arrays on this project):
#include <iostream>
#include <stdlib.h>
#include <time.h>
using namespace std;
void dice (int & x, int count);
int main ()
{
int count=0;
int x;
dice(x,count);
}
//-------------------------------
void dice (int & x,int count)
{
do
{
srand((unsigned)time(NULL));
x= (rand () %6+1);
cout<< x;
count++;
}
while (count<0);
{
cout<< x;
}
}
-------------------------------------------------------------------------------