Question: 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

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 #include #include

int main() { std::srand(static_cast(std::time(nullptr))); int counters[10] = {0};

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!