Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For weather reporting, the daily temperature will generally be given in degrees Celsius or Fahrenheit. Write a C++ program that will convert a temperature given

For weather reporting, the daily temperature will generally be given in degrees Celsius or Fahrenheit. Write a C++ program that will convert a temperature given in one system of units to the other. For example, if the temperature is given in degrees Fahrenheit convert it to Celsius, and vice versa.

Your program should prompt the user to provide a temperature value (object type double) and a single character (f or c) to indicate if the value is in degrees Fahrenheit or Celsius. Read in the temperature and scale values, then compute and display the corresponding equivalent temperature in the other scale system. Your output message should indicate whether the result is Celsius or Fahrenheit. For example:

Example 1: Enter the temperature: 26.6 Enter Celsius (c) or Fahrenheit (f): c The temperature in Fahrenheit is 79.88

Example 2: Enter the temperature: 93.2 Enter Celsius (c) or Fahrenheit (f): f The temperature in Celsius is 34

Use the following conversion formulas: F = C (9/5) + 32 C = (F 32) (5/9)

note: the programm should be in C++ language

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

Database Concepts International Edition

Authors: David M. Kroenke

6th Edition International Edition

0133098222, 978-0133098228

More Books

Students also viewed these Databases questions

Question

Explain the concept of shear force and bending moment in beams.

Answered: 1 week ago