37 lines
644 B
C++
Raw Normal View History

2021-03-11 11:24:36 -05:00
/*
* Write a program whose input is two integer and whose output is the two
* integers swapped
* Example
* Input:
* 3 8
* output:
* 8 3
* Must define and call a function
* void SwapValues(int& userVal1, int& userVal2)
*/
#include <iostream>
using namespace std;
/* Define your function here */
void SwapValues(int& userVal1, int& userVal2){
int temp;
temp = userVal1;
userVal1 = userVal2;
userVal2 = temp;
}
int main() {
/* Type your code here. Your code must call the function. */
int val1;
int val2;
cin >> val1;
cin >> val2;
SwapValues(val1, val2);
cout << val1 << " " << val2 << endl;
return 0;
}