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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 02:00, hctlawton
Which software would you use to create a print design? a. illustrator b. audacity c. reaper d. dreamweaver
Answers: 2
image
Computers and Technology, 23.06.2019 12:00, clevelandjaniya1
Which of these is a benefit of using objects in a powerpoint presentation? a. collaborators can create the external files while you create and edit the slide show. b. you can easily change the theme and design of the presentation. c. you can have older data in the source file while having up-to-date data in the presentation. d. collaborators can easily share the presentation.
Answers: 2
image
Computers and Technology, 23.06.2019 15:30, jasssp
Write a program in plp assembly that counts up by one starting from zero (or one) inside a loop and writes this value to the leds every time the value is increased. the memory address of the leds is 0xf0200000. the table below shows the meaning and an example usage of the instructions covered in the video, plp instructions for project 1. instruction example usage meaning load immediate li $t0, 8 register $t0 is set to the value, 8. store word sw $t2, 0($t1) the value in register $t1 is used as the memory address. the value in register $t2 is copied into this memory address. add addiu $t4, $t3, 29 register $t4 is assigned the sum of 29 and the value in register $t3. jump j your_label_name the program jumps to the line following the label, "your_label_name: ". label your label name: defines a label called "your_label_name: " that can be jumped to
Answers: 2
image
Computers and Technology, 23.06.2019 21:00, shyshy1791
Which set of steps will organize the data to only show foods with more than 100 calories and rank their sugar content from greatest to least?
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 in other subjects:

Konu
History, 05.03.2020 00:24