Help with function errors code

Hello, I am having trouble figuring out how to change the errors in this function to make the program run correctly. I copied the function and changed it to KelvinToCelsius, but still cannot figure out what else I need to include to make the program run.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

Copy-paste the CelsiusToKelvin function. Change the name to KelvinToCelsius, and modify the function accordingly. 

Sample program:

#include <iostream>
using namespace std;

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

   valueKelvin = valueCelsius + 273.15;

   return valueKelvin;
}

<STUDENT CODE>

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;
}
Below, do not type an entire program. Only type the portion indicated by the above instructions (and if a sample program is shown above, only type the <STUDENT CODE> portion.)
What errors are you getting?

Edit:If you just change the function name the contents would still be the same so the output would be missed up. You would just need to switch everything else in the function. Were it says valueKelvin change it to valueCelsius and then the valueCelsius, that you didn't change, to valueKelvin.


Last edited on
Topic archived. No new replies allowed.