Question: C++ : Function 1) Write a C++ function that swaps two numbers. Show how the function will be called from main0. Hint: Think if this

C++ : Function

C++ : Function 1) Write a C++ function that swaps two numbers.

1) Write a C++ function that swaps two numbers. Show how the function will be called from main0. Hint: Think if this function needs its parameters to be passed by value or reference. Think of the return type of the function. Note that the function needs to be returning two things as in if variable x had the integer 5 and variable y had integer 7 initially, after calling the swap function, variable x in mainO will have the integer 7 and variable y in main) will have the integer 5. [5]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!