Here in this problem, we are given three option to the user and the user have to choose any one of the first choices Celsius To Fahrenheit, the second choice Fahrenheit To Celsius and the Last one Exit without testing any one of the queries. C++ program to convert temperature from Fahrenheit to celsius and vice versa. Formula to convert celsius into Fahrenheit.
Fahrenheit to Celsius Table C++
Celsius = (Fahrenheit - 32) * 5 / 9;
Read: C Program to Convert Celsius to Fahrenheit And Vice Versa
1. Convert Celsius to Fahrenheit
2. Convert Fahrenheit To Celsius
Temperature Conversion Formula
Celsius To Fahrenheit
Fahrenheit = (Celsius * 9 / 5) + 32;
Celsius To Fahrenheit
Fahrenheit = (Celsius * 9 / 5) + 32;
Fahrenheit to Celsius Table C++
Celsius = (Fahrenheit - 32) * 5 / 9;
Read: C Program to Convert Celsius to Fahrenheit And Vice Versa
C++ Program to Convert Celsius to Fahrenheit And Vice Versa
#include <iostream>
using namespace std;
int main()
{
/*c++ program to convert Temperature from fahrenheit to celsius and vice versa */
int a;
cout << "1. For Celsius To Fahrenheit. \n";
cout << "2. For Fahrenheit To Celsius. \n";
cout << "3. For Exit\n\n";
cout << "Enter Your Choice \n ";
cin >> a;
switch (a)
{
double cel, feh;
case 1:
cout << "Enter The Temperature In Celsius\n";
cin >> cel;
feh = (cel *9 / 5) + 32;
cout << "\nTemperature In Fahrenheit Is = " << feh;
break;
case 2:
cout << "Enter The Temperature In Fahrenheit\n";
cin >> feh;
cel = (feh - 32) *5 / 9;
cout << "\nTemperature In Celsius Is = " << cel;
break;
case 3:
exit(0);
default:
cout << "\nEnter The Right Choice \n";
break;
}
}
The Output of Convert Celsius to Fahrenheit And Vice Versa
1. Convert Celsius to Fahrenheit
2. Convert Fahrenheit To Celsius
0 Comments: