(C++) please explain the steps since I am new
Implement a function that takes a temperature value in Centigrade and returns the corresponding value in Fahrenheit. Formula: ◦C x 9/5 + 32 = ◦F. For example: 37◦C x 9/5 + 32 = 98.6◦F.
#include <iostream> using namespace std; // function that takes a temperature value in Centigrade and returns the corresponding value in Fahrenheit double getF(double celsius){ return ((9.0 / 5.0) * celsius + 32); } int main() { double temp; cout<<"Enter celcius temperature: "; cin>>temp; cout<<"F = "<<getF(temp)<<endl; return 0; }
Get Answers For Free
Most questions answered within 1 hours.