Pair Swap Method
mediumQuestion 162Create a template class Pair<T> that holds two values of the same type.
The constructor takes two arguments: Pair(T a, T b)
Implement:
- swap(): swaps the two stored values
- print(): prints the two values separated by , followed by a newline
Do NOT write a main function.
Expected output
1, 2 2, 1
= newline. The output ends with a newline, so print one after the last line.
Hints4 available
Sign in to use hintsTopics
Templates
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)
Your output
Run your code to see the output here...
Test cases
Run your code to see test case results.