Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In C++. Using the CelsiusToKelvin function as a guide, create a new function, ch

ID: 3927099 • Letter: I

Question

In C++. Using the CelsiusToKelvin function as a guide, create a new function, changing the name to KelvinToCelsius, and modifying the function accordingly.

#include <iostream>
using namespace std;

double CelsiusToKelvin(double valueCelsius) {
double valueKelvin = 0.0;

valueKelvin = valueCelsius + 273.15;

return valueKelvin;
}

/* Your solution goes here */

int main() {
double valueC = 0.0;
double valueK = 0.0;

valueC = 10.0;
cout << valueC << " C is " << CelsiusToKelvin(valueC) << " K" << endl;

valueK = 283.15;
cout << valueK << " is " << KelvinToCelsius(valueK) << " C" << endl;

return 0;
}

Explanation / Answer

double KelvinToCelsius(double valueKelvin) {
double valueCelsius = 0.0;

valueCelsius = valueKelvin - 273.15;

return valueCelsius;
}