Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Functions Pass by Reference Objectives: Design and code multiple pass-by-reference functions to solve a single problem. Continue to code pass-by-value functions. Code and execute a

Functions Pass by Reference Objectives:

Design and code multiple pass-by-reference functions to solve a single problem.

Continue to code pass-by-value functions. Code and execute a program that has both types of functions used in it. Instructions:

Write a main method to: Set up two values in main, a and b.

read in two variables using a Read function while (a != 0)

print two variables using a Print function switch the data in the two variables, using a Swap function print two variables again using the Print function read in two variables using Read Function stop Read Function pass by reference Code a function that reads in two variables.

Print Function pass by value Code a function that prints out two variables with documentation, such as: The first value is ______ The second value is ______ Swap Function pass by reference Code a function that will switch the values of two memory positions in main Main Function Code a main method/function that will accomplish the 4 steps given above.

Remember that the data variable names defined in main can be different from the data variable names used in the functions.

Run: Run this program at least twice once with two integer values and a second time with two floating point values.

So how will you define your variables in main?

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

Step: 3

blur-text-image

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

Graph Databases

Authors: Ian Robinson, Jim Webber, Emil Eifrem

1st Edition

1449356265, 978-1449356262

More Books

Students also viewed these Databases questions

Question

=+5. Review the six categories of 50 strategies.

Answered: 1 week ago

Question

What is digital literacy? Why is it necessary?

Answered: 1 week ago