Question: Given main ( ) , complete class RandomNumbers ( in files RandomNumbers.h and RandomNumbers.cpp ) that has three integer data members: var 1 , var
Given main complete class RandomNumbers in files RandomNumbers.h and RandomNumbers.cpp that has three integer data
members: var var and var
Write a getter function for each variable: GetVar GetVar and GetVar
Then write the following member functions:
void PrintRandomValues prints out the random numbers in the format: "Random values: var var var
void SetRandomValues accepts a low and high integer values as parameters, and sets var var and var to random numbers
within the range of the low and high input values inclusive
To generate a bounded pseudorandom value, we use the rand function. rand is a builtin cpp function which generates a random value
between and the system constant RANDMAX. Using a little modular arithmetic, we can bound the results generated by rand to a low
high interval with the following:
rand low low
Note: if you're familiar with seeding srand for pseudorandom number generation, do not do that for this lab. If you don't know what
this means, ignore it
Once you're implemented each function that is declared in RandomNumbers.h in RandomNumbers.cpp you're finished.
Ex: If the input is:
the output is:
Random values:
where can be any random numbers within and inclusive
Note: When submitted, your program will be tested against different input range to verify if the three randomly generated values are within
range.
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
