Question: Option 1 : Write a program that will read two floating point numbers ( the first read into a variable called first and the second

Option 1: Write a program that will read two floating point numbers (the first read into a variable called first and the second read into a variable called second) and then calls the function swap with the actual parameters first and second. The swap function having formal parameters number1 and number2 should swap the value of the two variables. Note: This is similar to a program you did in Lesson Set 1; however, now you are required to use a function. You may want to look at logicprob.cpp from Lesson Set 1. Sample Run: Enter the first number Then hit enter 80 Enter the second number Then hit enter 70 You input the numbers as 80 and 70. After swapping, the first number has the value of 70 which was the value of the second number The second number has the value of 80 which was the value of the first number Exercise 1: Compile the program and correct it if necessary until you get no syntax errors. Exercise 2: Run the program with the sample data above and see if you get the same results. Exercise 3: The swap parameters must be passed by .(Assume that main produces the output.) Why?

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 Programming Questions!