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, 22.06.2019 08:10
Ihave a music player on my phone. i can buy songs, add them to playlists and play them. obviously it would be redundant to store each song in each playlist; each playlist is just a list of pointers to the songs. for this lab you will simulate this behavior. your program will need to have options to: add songs to the system library (you will store the text of the first line of the song, rather than the audio) add playlists add songs to a playlist list playlists play a playlist list all of the songs in the library with a count of how many times each song has been played remove a song from a playlist remove a playlist remove a song from the library (and thus from all playlists that contain it) note that we will not be checking many error cases. in real programming this would be bad, you should usually try to recognize and respond to as many types of errors as you can. in the context of class we are trying to acquaint you with as many concepts as possible, so for the sake of educational efficiency we will not be checking most errors in this lab, you may assume that your user provides correct input. you may add all appropriate error testing if you wish, but we will not be testing for it.
Answers: 2
question
Computers and Technology, 23.06.2019 00:20
Ihave been given the number of guns per 100, and the total firearm-related deaths per 100,000. i have to find the actual number of guns per country and actual number of gun-related deaths. if somebody could show me how to do 1 question, i can finish the rest, i am just confused. tia
Answers: 3
question
Computers and Technology, 23.06.2019 12:00
If you embed a word table into powerpoint, what happens when you make edits to the embedded data? a. edits made to embedded data change the data in the source file; however, edits made to the source file will not be reflected in the embedded data. b. edits made to embedded data will change the data in the source file, and edits made to the source file will be reflected in the embedded data. c. edits made to embedded data don't change the data in the source file, nor will edits made to the source file be reflected in the embedded data. d. edits made to embedded data don't change the data in the source file; however, edits made to the source file will be reflected in the embedded data.
Answers: 1
question
Computers and Technology, 23.06.2019 22:20
Learning sign language is an example of a(n) learning sign language is an example of a(n)
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
Mathematics, 16.11.2019 02:31
question
Mathematics, 16.11.2019 02:31