Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ Programming State the purpose of the function in your own words. Next specif

ID: 3862697 • Letter: C

Question

C++ Programming

State the purpose of the function in your own words. Next specify input that is needed for the function to complete the task, and state what input should be passed to the function as parameters and what would be acquired inside the function using the input function. Specify the expected output and state if the output will be returned to the function call or be sent to the monitor. Finally give the step by step process that will obtain the output from the input (the algorithm). In addition to these 4 items also specify test data that can be used for each function. Remember to describe your steps in enough detail so someone other than you could follow your algorithm and solve the problem. Also do not write any actual code.

Problem: Describe a function that would accept 7 values from the function call and determine the minimum and maximum of those 7 values without using the built-in functions. Design this function without using the idea of arrays. Send back to the function call the minimum and maximum value. You should use no more than 7 comparisons to find the maximum and no more than 7 comparisons to find the minimum.

Explanation / Answer

Function - A function can be defined as a named block of programming statements that are written to perform any task. This is a part of modular programmig. The set of statement that are written inside a function gets executed in a sequential manner. Functions also aids to make program more reusable. Other program can also use a pre-written function.

Example -

return type function_name(param 1,param2, .....param n) {

//set of statements

}

Input given to function - A function takes parameters which are nothing but the variables on which or using which the function is going to perform its task inside its body.Note- It is not mandatory that a function must have parameter. It may or may not have parameter(s).

Values returned by function- After performing its task, the function has to return the final calculated values to the calling function which can then be presented to the user.

Algorithm to find the maximum value --

Step 1: Start
Step 2: Read: Take Inputs X, Y, Z,A, B, C, D
Step 3: [Assigning] Set: BIGGEST = X
Step 4: If Y > BIGGEST then
Set: BIGGEST = Y
[End of If Structure]
Step 5: If Z > BIGGEST then
Set: BIGGEST = Z
[End of If Structure]

Step 6: If A > BIGGEST then
Set: BIGGEST = A
[End of If Structure]

Step 7: If B > BIGGEST then
Set: BIGGEST = B
[End of If Structure]

Step 8: If C > BIGGEST then
Set: BIGGEST = C
[End of If Structure]

Step 9: If D > BIGGEST then
Set: BIGGEST = D
[End of If Structure]

Step 10: Print: The Largest Number is BIGGEST.
Step 11: Stop

Algorithm to find the minimum value --

Step 1: Start
Step 2: Read: Take Inputs X, Y, Z,A, B, C, D
Step 3: [Assigning] Set: SMALLEST= X
Step 4: If Y < SMALLEST then
Set: SMALLEST= Y
[End of If Structure]
Step 5: If Z < SMALLEST then
Set: SMALLEST= Z
[End of If Structure]

Step 6: If A < SMALLEST then
Set: SMALLEST= A
[End of If Structure]

Step 7: If B < SMALLEST then
Set: SMALLEST= B
[End of If Structure]

Step 8: If C < SMALLEST then
Set: SMALLEST= C
[End of If Structure]

Step 9: If D < SMALLEST then
Set: SMALLEST= D
[End of If Structure]

Step 10: Print: The Smallest Number is SMALLEST
Step 11: Stop

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote