Question
C++ // Chapter 1: This program takes two values from the user and then swaps them // before printing the values. The user will be
C++ // Chapter 1: This program takes two values from the user and then swaps them // before printing the values. The user will be prompted to enter both numbers.end chapter1. /* This assignment revisits the program from chapter 1 that swaps two memory locations. Write a program that contains a function called swapNums. This function takes two integer parameters, .swaps them as we did in the above lab, and outputs the results (there is nothing to return). In main, ask the user to enter two different numbers, output them as entered (step 1), call the function swapNums() which will output the numbers swapped (step 2), and then output the values again in main (step 3). You should have three sets of output. Sample run (10 and 5 were entered by the user): (step 1) In main the two numbers are 10 and 5. (step 2) In swapNums, after swapping, the two numbers are 5 and 10. (from the function) (step 3) Back in main the two numbers are 10 and 5. */
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started