7.7.1: Function errors: Copying one function to create another. Using the CelsiusToKelvin function as a guide, create a new function, changing the name to KelvinToCelsius, and modifying the function accordingly. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 #include using namespace std; double CelsiusToKelvin(double valueCelsius) { double valueKelvin; valueKelvin = valueCelsius + 273.15; return valueKelvin; } /* Your solution goes here */ int main() { double valueC; double valueK; valueC = 10.0; cout << valueC << " C is " << CelsiusToKelvin(valueC) << " K" << endl; cin >> valueK; cout << valueK << " is " << KelvinToCelsius(valueK) << " C" << endl; 1 test passed All tests passed Run

Respuesta :

Answer:

double KelvinToCelsius(double valueKelvin) {

   double valueCelsius;

   valueCelsius = valueKelvin - 273.15;

   return valueCelsius;

}

Explanation:

Create a function called KelvinToCelsius that takes a double parameter, valueKelvin

Inside the function:

Declare a new variable valueCelsius to hold the value in Celsius

Convert the passed value into Celsius value using the formula

Return the valueCelsius

Functions are set of related codes, that are named and grouped in a block, where they perform as a unit code.

The missing part of the program in C++ is as follows:

double KelvinToCelsius(double valueKelvin) {

double valueCelsius = valueKelvin - 273.15;

return valueCelsius;

}

The flow of the above code segment is as follows

  • The first line defines the function
  • The second line calculates valueCelsius by subtracting 273.15 from valueKelvin
  • The last line returns the calculated temperature in degree Celsius

At the end of the function, the function returns the equivalent temperature in degree Celsius to the main method

Read more about functions at:

https://brainly.com/question/15820683

ACCESS MORE