Given two double variables, bestValue and secondBestValue, write some code that swaps their values.

Given two double variables, bestValue and secondBestValue, write some code that swaps their values.

LANGUAGE: C++

CHALLENGE:

Given two double variables, bestValue and secondBestValue, write some code that swaps their values. Declare any additional variables as necessary.

SOLUTION:



double tempNum;
tempNum = bestValue;
bestValue = secondBestValue;
secondBestValue = tempNum;

Add comment