Write a C++ prorgam with a function named getRandomMidpoint. This function should accept two arguments just like getMidpoint (getMidpoint. This function takes two int parameters, and returns the midpoint of the two integers. It has the following signature: int getMidpoint(int low, int high). But it should return a random number in between the low and high arguments. You can swap this function with the getMidpoint function to change the nature of how the program makes its guesses. Make sure to show output of your program using both getMidpoint and getRandomMidpoint showing different behaviors. Don't forget to add a call to srand() at the beginning of your program in main() to make sure each run of the program generates new "random" numbers.
Write a C++ prorgam with a function named getRandomMidpoint. This function should accept two arguments just like getMidpoint (getMidpoint. This function takes two int parameters, and returns the midpoint of the two integers. It has the following signature: int getMidpoint(int low, int high). But it should return a random number in between the low and high arguments. You can swap this function with the getMidpoint function to change the nature of how the
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images