Answered step by step
Verified Expert Solution
Question
1 Approved Answer
good afternoon this is for c++ i have this code so far but my professor doesn't want us to use array i don't know really
good afternoon this is for c++ i have this code so far but my professor doesn't want us to use array i don't know really how to use int variable to store the random numbers starting with the digits 1 to 10 please help
#include
int main() { std::srand(static_cast
for (int count = 1; count
for (int i = 0; i
return 0; }
Write a program that tests the function that generates random integers. Your program should generate 10,000 random integers between 0 and 99 , and then count the number of generated integers that begin with each digit from 0 to 9 . Because the random number generator creates uniformly distributed integers, the number of integers in each category should be approximately equal. Write a function that returns a randomly generated integer between 0 and 99 . Call this function to generate each integer. We haven't introduced the C++ array, so use 10 different int variables - count0, count1, count2, count 3,, count 9 - to count the number of generated integers that fall into each category. For instance, count 3 will hold the count of the integers that begin with the digit 3. Use a switch statement in your program. There should be a case for each digit. Once all the integers have been counted, your program should print 10 lines giving the results of your test a line for each digit k that gives a message similar to: The number of integers beginning with digit k is countk. (k and countk will have specific integer values.)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