By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 1,131 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

dice rolling program in C

P: 3
I need help with writing a program to use randmax and the standard deviation when u roll the dice 10000 times I know you will need the standard dev. and the average where do i put the randmax and do i use 1+6 after it ?



LOST!
Oct 16 '06 #1
Share this Question
Share on Google+
4 Replies


Banfa
Expert Mod 5K+
P: 8,916
You question is not clear, some code would go a long way to enlightening us.
Oct 16 '06 #2

P: 3
here is a sample program. Im really lost and dont know where to go from here. We use gcc to compile. I need to roll the dice 10000 times and fine standard devi and average. I know I nned to use randmax and 6-1 I think but donr know where to put them? Please help.


#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
int main()
{
int i,a[1000], float sum=0, avg, std;
srand(time(NULL));

for (i=0;i<1000;i++) a[i]=....;

for (i=0;i<1000;i++) sum+= ....;

...................;
return 0;
}
Oct 19 '06 #3

P: 3
here is a sample program. Im really lost and dont know where to go from here. We use gcc to compile. I need to roll the dice 10000 times and fine standard devi and average. I know I nned to use randmax and 6-1 I think but donr know where to put them? Please help.


#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
int main()
{
int i,a[1000], float sum=0, avg, std;
srand(time(NULL));

for (i=0;i<1000;i++) a[i]=....;

for (i=0;i<1000;i++) sum+= ....;

...................;
return 0;
}
Oct 19 '06 #4

Banfa
Expert Mod 5K+
P: 8,916
Please don't double post.

Try reading this thread
Oct 19 '06 #5

Post your reply

Sign in to post your reply or Sign up for a free account.