My program converts from Fahrenheit to Celsius and vice versa, with the option of displaying the Kelvin temperature with a Y/N message. When compiling, two error messages pop up saying function does not take 1 parameters in regards to the showDegreesK function. Can someone figure out what I need to do to fix this?
You need to think about what showDegrees() should do. Looking at your main program, I suggest something like:
1 2
// If kchoice is 'Y' then convert "celcius" to kelvin and print it.
// In either case, print a newline
Now write that code to do that:
1 2 3 4 5 6 7 8 9 10 11
// If kchoice is 'Y' then convert "celcius" to kelvin and print it.
// In either case, print a newline
void
showDegreesK(char kchoice, double celcius)
{
if (kchoice == 'Y') {
double kelvin = celcius + 273.15;
cout << " and " << kelvin << 'K';
}
cout << endl;
}
This is an important point: decide what your functions should do first, then write code to do that.
Change the declaration at line 9 to match this definition.
Also don't print the endl at lines 32 and 42. showDegrees will do that for you.