I wrote a small dice rolling program that will print out the results of however many dice rolls that are entered. I want to count how much each number occurs so I thought I would put the output from the rand() function into an array and then search the array for the different values. I don't know how to put numbers into an array that are not entered in manually.
#include <stdio.H>
#include <stdlib.h>
#include <time.h>
int main(void)
{
int count;
int roll;
srand(time(NULL));
printf("How many dice are being rolled?\n");
scanf("%d", &count);
printf("\nDice Rolls\n");
for (roll = 0; roll < count; roll++)
{
printf("%d\n", rand() % 6 + 1);
}
return 0;
}
<stdio.H>. I think you meant<stdio.h>. Which book are you reading?