i got some thing like this and couldnt move a head
#include <iostream>
#include <ctime>
# include <cstdlib>
int rolldice (void);
int main ( void)
{
srand (time(0));
int array [12] = { 1,2,3,4,5,6,7,8,9,10,11,12};
int counter = 0;
for (int i= 0; i<=36000; i++)
++counter [ 1+rand()%6];
{
sum = rolldice();
switch (sum)
{
int die1;
int die2;
int sum;
die1 = ( 1+ rand ()% 6);
die2 = ( 1+ rand ()% 6);
sum = die1+die2;
return sum;
}
}
}
Please tell me now what to do???
#include <iostream.h>
#include <ctime.h>
#include <stdlib.h>
int rolldice ();
int main ()
{
int array [13] = { 0 }; // Set all 13 counters to 0
srand (time (0));
for (int i=0; i<=36000; i++)
{
array [rolldice ()]++;
}
for (int iSum=2; iSum<13; iSum++) {
cout << "Sum of " << iSum << " appeared " << array [iSum] << " times." << endl;
}
return 0;
} // end 'main()'
int rolldice ()
{
return (1 + rand ()%6) + (1 + rand ()%6);
}
--------------------------------------------------------------------------------