Create a program that: 1. Has two functions, both functions have the same name -- increase. 2. One function returns an integer and has an integer as a parameter. This function will double the value of the integer parameter and return the doubled value. This function will also contain a static integer to be used as a counter. 3. One function returns no value (void) and has two integer parameters passed by reference. This function will triple the value of the first integer parameter and will increment the value of the second parameter (used as a counter). The function will return BOTH values through the reference parameters. 4. Basic functionality: a. Request an integer from the user, the request should include the message "Enter -1 to quit" b. Loop until the user enters -1 c. Function 1: If the user enters an ODD value, call increase (one integer parameter passed by value, returns an integer) passing the integer by value; Double the integer and RETURN the value from the function. Upon return from the function, output the value RETURNED. This should have a static int that counts the number of times the function is called. d. Function2: If the user enters an EVEN value, call increase (two integer parameters passed by reference, returns no value): triple the first integer value. Increment the counter integer. Return the updated values via the reference parameters. Upon return from the function, output the value that was tripled. e. BOTH FUNCTIONS: When EACH function is called, increment the appropriate counter variable IN THE FUNCTION (static or reference).               Also output a statement: "This function has been called x times", where x is the number of times THAT function has been called. Do not display x, display the value of the appropriate counter variable. Place this output statement where most appropriate for the variable type declared for the counter. 5. Test the functions/program with several even and odd inputs. Test when -1 entered at the beginning. 6. Write the function PROTOTYPEs prior to main; define/write the function code after main. Complete as much as you can before you leave ensuring what you've completed compiles. These labs are entirely for your practice. The program may be named any name of our choice, must have a .cpp extention; variables may be any name of your choice.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter6: User-defined Functions
Section: Chapter Questions
Problem 9SA
icon
Related questions
Question
Create a program that:
1. Has two functions, both functions have the same name -- increase.
2. One function returns an integer and has an integer as a parameter.
This function will double the value of the
integer parameter and return the doubled value. This function will
also contain a static integer to be used
as a counter.
3. One function returns no value (void) and has two integer parameters
passed by reference. This function will triple the
value of the first integer parameter and will increment the value of
the second parameter (used as a counter). The
function will return BOTH values through the reference parameters.
4. Basic functionality:
a. Request an integer from the user, the request should include the
message "Enter -1 to quit"
b. Loop until the user enters -1
c. Function 1: If the user enters an ODD value, call increase (one
integer parameter passed by value, returns
an integer) passing the integer by value;
Double the integer and RETURN the value from the function.
Upon return from the function, output the value RETURNED.
This should have a static int that counts the number of times the
function is called.
d. Function2: If the user enters an EVEN value, call increase (two
integer parameters passed by reference, returns
no value):
triple the first integer value.
Increment the counter integer.
Return the updated values via the reference parameters.
Upon return from the function, output the value that was tripled.
e. BOTH FUNCTIONS: When EACH function is called, increment the
appropriate counter variable IN THE FUNCTION
(static or reference).
 
 
 
 
 
 
 
Also output a statement: "This function has been called x times",
where x is the number of times THAT function has been called.
Do not display x, display the value of the appropriate counter
variable.
Place this output statement where most appropriate for the
variable type declared for the counter.
5. Test the functions/program with several even and odd inputs. Test
when -1 entered at the beginning.
6. Write the function PROTOTYPEs prior to main; define/write the function
code after main.
Complete as much as you can before you leave ensuring what you've
completed compiles. These labs are
entirely for your practice.
The program may be named any name of our choice, must have a .cpp
extention; variables may be any name
of your choice.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr