Question
/* moreRand.c This program generates 100 (pseudo)random integers and stores them in an array. */ /* includes rand() */ #include stdafx.h #include int main (void)
/* moreRand.c This program generates 100 (pseudo)random integers and stores them in an array. */ /* includes rand() */ #include "stdafx.h" #include
Your task now is to modify the program to repeatedly call roll and then keep track of how many times each number (1 through 6) occurs. Make the following changes to main: Remove the array R. Instead, introduce an integer variable r, which youll use to grab the most recently generated number (i.e., the value returned by roll()). Set up an integer array count[7], and use a loop to initialize all of its elements to 0. This array will be used to keep track of how many times a particular number is rolled. For example, count[5] will indicate how many times the result of a roll was 5.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started