Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a C++ program that accepts a number followed by one space and then a lette

ID: 440387 • Letter: W

Question

Write a C++ program that accepts a number followed by one space and then a letter. If the letter following the number is f, the program is to treat the number entered as a temperature in degrees Fahrenheit, convert the number to the equivalent degrees Celsius, and display a suitable message. If the letter following the number is c, the program is to feat the number as a temperature in degrees Celsius, convert the number to equivalent degrees Fahrenheit, and display a suitable message. If the letter is neither f nor f, the program is to display a message that the date entered is incorrect and terminate. Use an if-else chain in your program and make use of these conversion formulas: Celsius= (5.0/9.0)times(Fahrenheit- 32.0) Fahrenheit= (9.0/5.0)times Celsius+ 32.0)

Explanation / Answer

#include #include void main() { float Fahrenheit, Celsius; clrscr(); printf("Enter Temperature in Fahrenheit "); scanf("%f",&Fahrenheit); Celsius = 5.0/9.0 * (Fahrenheit-32); printf(" Temperature in Fahrenheit = %f", Fahrenheit); printf(" Temperature in Celsius = %f", Celsius); getch(); }
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote