Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transactions On Large Scale Data And Knowledge Centered Systems Xxviii Special Issue On Database And Expert Systems Applications Lncs 9940

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Qimin Chen

1st Edition

3662534541, 978-3662534540

More Books

Students also viewed these Databases questions