Question
General requirements: - No global variables - No multiple return statements in one function - Show how you have tested these functions - You can
General requirements:
- No global variables
- No multiple return statements in one function
- Show how you have tested these functions
- You can use cin and cout in this function but please do not print out the results.
It should return the values to the caller through the use of return type and pass-by-reference parameters.
- Please do not use tuple or pair class.
Please use only pass-by-reference parameters and return type to return values to the caller.
- Please do not use arrays. Please use only simple variables to keep track of the information.
Note: this is an exercise to use functions and not array.
Write a function named "countBetween" that reads in from the user a list of numbers until the user re-enters the first number. It will return the count of how many numbers between the first numbers. In addition, it returns a boolean flag that indicates whether the numbers in between are all more or less than the first number but not both.
For example, if the user enters 10, 10, it will return 0 and false.
If the user enters 10, 30, 40, 10 it will return 2 and true (all numbers are more than the first number)
If the user enters 10, 20, 30, 5, 10, it will return 3 and false.
If the user enters 50, 10, 40, 30, 50, it will return 3 and true (all numbers are less than the first number)
If the user enters 0, 10, 0, it will return 1 and true.
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