need help we are using c to program Write a program that wil



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

Solution

#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;
}

 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 Celsiu

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site