Page 1 of 1

C++ 6.25 LAB: Swapping variables

Posted: Mon Jun 06, 2022 1:18 pm
by answerhappygod
C++ 6.25 LAB: Swapping variables
C 6 25 Lab Swapping Variables 1
C 6 25 Lab Swapping Variables 1 (71.33 KiB) Viewed 71 times
6.25 LAB: Swapping variables Define a function named SwapValues that takes four integers as parameters and swaps the first with the second, and the third with the fourth values. Then write a main program that reads four integers from input, calls function SwapValues() to swap the values, and prints the swapped values on a single line separated with spaces. Ex: If the input is: 3 8 2 4 function SwapValues()) returns and the main program outputs: 8342 The program must define and call a function: void SwapValues (int& userVall, int& userVal2, int& userVal3, int& userVal4) Function SwapValues() swaps the values referenced by the parameters. 406896.2611930.qx3zqy7 LAB ACTIVITY 6.25.1: LAB: Swapping variables 0/10 main.cpp Load default template... 1 #include <iostream> 2 using namespace std; 3 4 /* Define your function here */ 5 6 int main() 7 /* Type your code here. Your code must call the function. */ 8 9 return 0; 10