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

need help!! we are using c++ to program Write a program that will first allow a

ID: 3788694 • Letter: N

Question



need help!! we are using c++ to program

Write a program that will first allow a user to choose one of two options: 1. Convert a temperature from degrees Celsius to degrees Fahrenheit. 2. Convert a temperature from degrees Fahrenheit to degrees Celsius. The program should then prompt for the temperature value to be entered and output the new value that results from the conversion. To convert from Celsius to Fahrenheit you can multiply the value by 1.8 and then add 32. To convert from Fahrenheit to Celsius, you can subtract 32 from the value, then multiply by 5 and divide the result by 9 Screen Output Examples 1. degree C to degree F

Explanation / Answer

#include <iostream>
using namespace std;

int main()
{
  
   cout<<"1. Convert a temperature from degrees Celsius to degrees Fahrenheit."<<endl;
   cout<<"2. Convert a temperature from degrees Fahrenheit to degrees Celsius."<<endl;
   cout<<"Select one of the options:";
   int op;
   double temp;
   cin>>op;
   cout<<"Enter a temperature:";
   cin>>temp;
   if(op==1)
   {
       cout<<"The temperature in Fahrenheit is "<<   temp*1.8+32<<endl;
   }
   else
   {
       cout<<"The temperature in Celsius is "<< (temp-32.0)/1.8 <<endl;
   }

   return 0;
}