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 03:30
Many everyday occurrences can be represented as a binary bit. for example, a door is open or closed, the stove is on or off, and the fog is asleep or awake. could relationships be represented as a binary value? give example.
Answers: 1
question
Computers and Technology, 24.06.2019 01:30
Hazel has just finished adding pictures to her holiday newsletter. she decides to crop an image. what is cropping an image?
Answers: 1
question
Computers and Technology, 24.06.2019 10:00
1. which of these is not true about torsion bars? a. they can be used to adjust ride height b. they can be adjusted anytime since they don't affect alignment angles c. they attach between the frame and the lower control arm d. they twist to produce a spring effect
Answers: 1
question
Computers and Technology, 24.06.2019 11:00
In three to five sentences, describe how you can organize written information logically and sequentially
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
Mathematics, 14.07.2019 06:30
question
Mathematics, 14.07.2019 06:30
Questions on the website: 13722367