Question
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started