subject

#include using namespace std;void Swap(int x, int y); //prototypeint main(){ int num1, num2; cout << "Please enter two numbers to swap, the same numbers will quit." << endl; cin >> num1 >> num2; while (num1 != num2) { Swap(num1,num2); cout << "After swap, the numbers are " << num1 << " " << num2 << endl; cout << "Please enter two numbers to swap, "; cout << "the same numbers will quit." << endl; cin >> num1 >> num2; } cout << "Thanks!" << endl; return 0; }This subroutine swaps two numbers//void Swap(int x, int y){ int temp; temp = x; x = y; y = temp;}1. Type in the above program as swap. cpp. Add a comment to include your name and date. Compile and run with different values.2. To find out why this is not working, add the following output statements to the swap function. a. cout << " beginning of swap" << x << " " << y << endl;b. cout << " end of swap" << x << " " << y << endl;Are the variables being swapped inside the swap function?3. Explain why this program is not working correctly.4. Fix the program so the swap will work. Compile and run and be sure the swap works.5. Submit a copy of the final listing and output. Also include a copy of the hierarchy chart for the program.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 12:00
What does the level 1 topic in a word outline become in powerpoint? a. first-level bullet item b. slide title c. third-level bullet item d. second-level bullet item
Answers: 1
question
Computers and Technology, 24.06.2019 18:30
*write a program that defines symbolic names for several string literals (chars between quotes). * use each symbolic name in a variable definition. * use of symbolic to compose the assembly code instruction set can perform vara = (vara - varb) + (varc - vard); ensure that variable is in unsigned integer data type. * you should also further enhance your symbolic logic block to to perform expression by introducing addition substitution rule. vara = (vara+varb) - (varc+vard).
Answers: 1
question
Computers and Technology, 25.06.2019 05:30
Your mother is sure that you were driving too fast because she knows a. when you arrived and the direction you came from. b. how long it took you to get home and how far you traveled. c. what time you left and how long it took you to get home. d. the direction you were driving and how far you traveled.
Answers: 2
question
Computers and Technology, 25.06.2019 09:30
Network administration is concerned with which tasks? the installation and maintenance of network hardware and software the installation and maintenance of computer operating systems the diagnosis and repair of some types of computer hardware the monitoring of users' activity on a social networking site
Answers: 1
You know the right answer?
#include using namespace std;void Swap(int x, int y); //prototypeint main(){ int num1, num2; cout &l...
Questions
question
Biology, 16.10.2020 06:01
question
Chemistry, 16.10.2020 06:01
question
Physics, 16.10.2020 06:01
Questions on the website: 13722360