Answer to Question #328854 in C++ for Program Training

Question #328854

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


1
Expert's answer
2022-04-18T08:41:25-0400
#include <iostream>

using namespace std;

float CelsiusToKelvin(float cel)
{
	return cel + 273.15;
}

float KelvinToCelsius(float kel)
{
	return kel - 273.15;
}

int main()
{
	float kel, cel;
	cout << "Please, enter temperature in Kelvin to get in Celsius: ";
	cin >> kel;
	cout << "The temperature in Celsius is " << KelvinToCelsius(kel) << endl;
	cout << "Please, enter temperature in Celsius to get in Kelvin: ";
	cin >> cel;
	cout << "The temperature in Celsius is " << CelsiusToKelvin(cel);
}







Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS