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, 21.06.2019 21:40
Write c function that can replace all the positive elements to 0 and negative to 1 in undefined length one-dimensional array. test your program in the main program by defining one-dimensional array of 6 elements
Answers: 1
question
Computers and Technology, 22.06.2019 06:00
The width of a piece of rectangular land is 5m shorter rhan 1/3 of its length .find the width of the land if the length is 60m,150m.
Answers: 1
question
Computers and Technology, 22.06.2019 18:30
Which of the following commands is more recommended while creating a bot?
Answers: 1
question
Computers and Technology, 23.06.2019 07:10
If you want to import a picture into a dtp application, what must you do first? draw an image frame. import text. open the folder containing the file. select get image… from the windows menu.
Answers: 2
You know the right answer?
#include using namespace std;void Swap(int x, int y); //prototypeint main(){ int num1, num2; cout &l...
Questions
question
Chemistry, 02.12.2020 22:40
question
Health, 02.12.2020 22:40
question
Mathematics, 02.12.2020 22:40
question
History, 02.12.2020 22:40
question
English, 02.12.2020 22:40
question
Mathematics, 02.12.2020 22:40
question
Mathematics, 02.12.2020 22:40
question
History, 02.12.2020 22:40
Questions on the website: 13722362