Write some code that swaps their values. Declare any additional variables as necessary, but do not redeclare firstPlaceWinner and secondPlaceWinner.

LANGUAGE: C++

CHALLENGE:

Given two int variables, firstPlaceWinner and secondPlaceWinner, write some code that swaps their values.
Declare any additional variables as necessary, but do not redeclare firstPlaceWinner and secondPlaceWinner.

SOLUTION:



int x;
x = firstPlaceWinner;
firstPlaceWinner = secondPlaceWinner;
secondPlaceWinner = x;