Hi, I have to write a program that will use a random number generator to roll two standard dice. and then graph the data. this is what i have so far:
Code:
int main(){
int die1;
int die2;
int total[5000];
int role;
int j,i;
//asking for number of times dice are to be rolled
printf("How manytimes do you want to role the dice?(100-5000): \n");
scanf("%d", &role);
while( role < 100 || role > 5000)
{
if( role < 100 || role > 5000)
{
printf("\nPlease enter a number between 100 and 5000: ");
scanf("%d", &role);
}
}
// initialize random see
srand (time(NULL));
//loop to store rolles into errays
for(i = 0; i < role; i++){
//genreate number between 1 and 6
die1 = rand() %6 + 1;
die2 = rand() %6 + 1;
total[i] = die2 + die1;
}
//printf("\ntotal: %d\n", total);
for(j=0; j<role; j++){
printf("%d ", total[j]);
}
return 0;
}
So far I have put the total sum of both dice into an array.
but now I have to graph it into a data and I am really lost on how to do this, can someone please give me a push in the right direct as to what i should do next? Thank you!