Question: IN C PLUS Given integer inputs howMany and maxNum, generate a vector of howMany unique random integers from 0 to maxNum ( exclusive ) .
IN C PLUSGiven integer inputs howMany and maxNum, generate a vector of howMany unique random integers from to maxNum exclusive
The structure of the program is:
main calls UniqueRandomInts with arguments howMany, and maxNum.
UniqueRandomInts returns a vector of howMany unique random integers.
The required output is already provided in main and PrintNums
Complete UniqueRandomInts which generates random integers until howMany unique integers have been collected in vector nums.
Hint: If a generated number is new, add the number to vector nums and set alreadySeen. If the number has been seen before, increment the global variable retries and generate another random integer.
Note: For testing purposes, the random number generator is seeded with a fixed value in main
Ex: When the input is:
the output is
retries
Compare and contrast each data structure and provide appropriate examples of each, showing the types of applications that each data structure is suited for.
Hint: the declaration of the friend function is provided in Number.h
Ex: if the value of yourNum is then the output is:
The value is
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
