Hey all,
I was interested in learning how to program and one of my friends had me do a few exersizes.... yet i am completley lost. he wants me to do these things using arrays and loops:
write a program that will simulate the rolling of two dice in 6000 trials:
1. use a pair of arrays to store the trial results (got it)
2. print a table of results that shows the number of times each possible total of the two dice was obtained. label row and column
What? i cant get this.... help
3. use a third arry to store the info required
4. display som of 2 at the top and sum 12 at the bottom
5.each row in your chart should show the # of dots, the # of times that # of dots came up (frequency), and the proportion of total trials on which that number of dots came up (frequency/total trials) as a float.
6.use a fourth array to record the information required for this table
7. display double 6's at the top row and double 1's at the bottom
AHHHHH!!! i would ask my friend, yet he is out of town.....this is what i have so far (not much hehe):
Code:
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#define ROLLS 10
void main (void)
{
int dieone [ROLLS];
int dietwo [ROLLS];
int i;
int sum;
srand((int)time(NULL));
printf("Dieone Dietwo Sum\n");
printf("-------------------------");
for(i=0;i<ROLLS;i++)
{
dieone[i ]=rand()%6+1;
dietwo[i ]=rand()%6+1;
sum= dieone[i ] + dietwo[i ];
printf("\n%i %i %i\n",dieone[ i],dietwo[i ],sum);
}
}
Any help or anything would be greatly appreciated.....man this must sound so dumb.... well, its only my 2nd day so HELP!
thanks alot
Code tags added by Kermi3, I also inserted spaces in all [I ] so that they appear in teh code instead of causing italics.