Write a menu driven C program (not java or python) with the following choice of submenu items: Enter 1 to convert from Celsius to Fahrenheit Enter 2 to convert from Fahrenheit to Celsius Select 1 or 2: Use a function Celsius which returns Celsius equivalent of a Fahrenheit temperature. C = (5/9)*(F-32) Use a function Fahrenheit which returns Fahrenheit equivalent of a Celsius temperature. F = (9/5)*C + 32 Use the functions above to write a program which converts from Celsius to Fahrenheit or from Fahrenheit to Celsius and displays the result. Your program should repeat as long as the user enters 1 or 2 as the choice. Sample run 1: Enter 1 to convert from Celsius to Fahrenheit Enter 2 to convert from Fahrenheit to Celsius Select 1 or 2: 1 Enter temperature in Celsius: 5 5.00 Celsius = 41.00 Fahrenheit Enter 1 to convert from Celsius to Fahrenheit Enter 2 to convert from Fahrenheit to Celsius Select 1 or 2: 2 Enter temperature in Fahrenheit: 33 33.00 Fahrenheit = 0.56 Celsius Enter 1 to convert from Celsius to Fahrenheit Enter 2 to convert from Fahrenheit to Celsius Select 1 or 2: -1 STOP! Sample run 2: Enter 1 to convert from Celsius to Fahrenheit Enter 2 to convert from Fahrenheit to Celsius Select 1 or 2: 1 Enter temperature in Celsius: 1 1.00 Celsius = 33.80 Fahrenheit Enter 1 to convert from Celsius to Fahrenheit Enter 2 to convert from Fahrenheit to Celsius Select 1 or 2: 1 Enter temperature in Celsius: -2.5 -2.50 Celsius = 27.50 Fahrenheit Enter 1 to convert from Celsius to Fahrenheit Enter 2 to convert from Fahrenheit to Celsius Select 1 or 2: 2 Enter temperature in Fahrenheit: 0.4 0.40 Fahrenheit = -17.56 Celsius Enter 1 to convert from Celsius to Fahrenheit Enter 2 to convert from Fahrenheit to Celsius Select 1 or 2: 3 STOP!

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter4: Selection Structures
Section4.3: Nested If Statements
Problem 7E
icon
Related questions
Question

Write a menu driven C program (not java or python) with the following choice of submenu items:
Enter 1 to convert from Celsius to Fahrenheit
Enter 2 to convert from Fahrenheit to Celsius
Select 1 or 2:
Use a function Celsius which returns Celsius equivalent of a Fahrenheit temperature.
C = (5/9)*(F-32)
Use a function Fahrenheit which returns Fahrenheit equivalent of a Celsius temperature.
F = (9/5)*C + 32
Use the functions above to write a program which converts from Celsius to Fahrenheit or from
Fahrenheit to Celsius and displays the result. Your program should repeat as long as the user enters 1 or 2 as the choice.


Sample run 1:

Enter 1 to convert from Celsius to Fahrenheit
Enter 2 to convert from Fahrenheit to Celsius
Select 1 or 2: 1
Enter temperature in Celsius: 5
5.00 Celsius = 41.00 Fahrenheit
Enter 1 to convert from Celsius to Fahrenheit
Enter 2 to convert from Fahrenheit to Celsius
Select 1 or 2: 2
Enter temperature in Fahrenheit: 33
33.00 Fahrenheit = 0.56 Celsius
Enter 1 to convert from Celsius to Fahrenheit
Enter 2 to convert from Fahrenheit to Celsius
Select 1 or 2: -1
STOP!


Sample run 2:
Enter 1 to convert from Celsius to Fahrenheit
Enter 2 to convert from Fahrenheit to Celsius
Select 1 or 2: 1
Enter temperature in Celsius: 1
1.00 Celsius = 33.80 Fahrenheit
Enter 1 to convert from Celsius to Fahrenheit
Enter 2 to convert from Fahrenheit to Celsius
Select 1 or 2: 1
Enter temperature in Celsius: -2.5
-2.50 Celsius = 27.50 Fahrenheit
Enter 1 to convert from Celsius to Fahrenheit
Enter 2 to convert from Fahrenheit to Celsius
Select 1 or 2: 2
Enter temperature in Fahrenheit: 0.4
0.40 Fahrenheit = -17.56 Celsius
Enter 1 to convert from Celsius to Fahrenheit
Enter 2 to convert from Fahrenheit to Celsius
Select 1 or 2: 3
STOP!

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 5 images

Blurred answer
Knowledge Booster
ADT and Class
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
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning