Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Question 1

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:

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;

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Refactoring Databases Evolutionary Database Design

Authors: Scott Ambler, Pramod Sadalage

1st Edition

0321774515, 978-0321774514

More Books

Students also viewed these Databases questions

Question

4. Is process variability recognised?

Answered: 1 week ago

Question

What does this public know about your organization?

Answered: 1 week ago