To convert between Celsius and Fahrenheit, the following formula is used, where C = Celsius temperature and F = Fahrenheit temperature: C = 5/9 * (F-32) Write a C++ temperature conversion program which does the following: Write a function called toCelsuis which takes a Fahrenheit temperature as a parameter, and returns the equivalent Celsius temperature: float toCelsius(float) Demonstrate that your function works by writing a main() function that prints out a conversion table.  It should have Fahrenheit values 60, 61, 62, ... through 80 (21 temperatures in total) and should also have the corresponding Celsius temperatures that your function calculated.  So your output should look something like this (with 21 temperature conversions total, I used ... to save space here for most of them): Welcome to the temperature table! F      C 60    15.6 61     16.1 ...    ... 80     26.7     If you like: you can add this line in your function to make floating point output fixed, make sure you #include   cout.setf(ios::fixed, ios::floatfield); If you like: you can then call setprecision(1) in your cout statements to print out one decimal place, e.g.  cout << setprecision(1) << celsius;

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter6: Modularity Using Functions
Section6.1: Function And Parameter Declarations
Problem 4E: (Statics) A beam’s second moment of inertia, also known as its area moment of inertia, is used to...
icon
Related questions
Question

To convert between Celsius and Fahrenheit, the following formula is used, where C = Celsius temperature and F = Fahrenheit temperature:

C = 5/9 * (F-32)

Write a C++ temperature conversion program which does the following:

  • Write a function called toCelsuis which takes a Fahrenheit temperature as a parameter, and returns the equivalent Celsius temperature:

float toCelsius(float)

  • Demonstrate that your function works by writing a main() function that prints out a conversion table.  It should have Fahrenheit values 60, 61, 62, ... through 80 (21 temperatures in total) and should also have the corresponding Celsius temperatures that your function calculated.  So your output should look something like this (with 21 temperature conversions total, I used ... to save space here for most of them):

Welcome to the temperature table!
F      C
60    15.6
61     16.1
...    ...
80     26.7    

  • If you like: you can add this line in your function to make floating point output fixed, make sure you #include<iomanip>

      cout.setf(ios::fixed, ios::floatfield);
  • If you like: you can then call setprecision(1) in your cout statements to print out one decimal place, e.g.  cout << setprecision(1) << celsius;
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Types of Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr