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.
.
.
Click on the title for the solution
.
.
int x;
x=firstPlaceWinner;
firstPlaceWinner=secondPlaceWinner;
secondPlaceWinner=x;
.
Click on the title for the solution
.
.
This is the answer:
:
int x;
x=firstPlaceWinner;
firstPlaceWinner=secondPlaceWinner;
secondPlaceWinner=x;
Comments
Post a Comment