#include <iostream>
using namespace std;
int CelsiustoFahrenheit()
{
float celsius;
cin >> celsius;
float fahrenheittemp;
fahrenheittemp = celsius * 1.8 +32;
};
int FahrenheittoCelsius()
{
float celsiustemp;
float fahrenheittemp;
cin >> fahrenheittemp;
celsiustemp = (fahrenheittemp-32)/1.8 ;
};
int main()
{
int choice;
float celsiustemp,fahrenheittemp;
cout << "1.Celsius to Fahrenheit" << endl;
cout << "2.Fahrenheit to Celsius" << endl;
cout << "Choose between 1 & 2 : " << endl;
cin>>choice;
if (choice==1)
{
cout << "Enter the temperature in Celsius : " << endl;
cin>>celsiustemp;
fahrenheittemp=(1.8*celsiustemp)+32;
cout << "Temperature in Fahrenheit = " << FahrenheittoCelsius()<< endl;
return 0;
}
else
{
cout << "Enter the temperature in Fahrenheit : " << endl;
cin>>fahrenheittemp;
celsiustemp=(fahrenheittemp-32)/1.8;
cout << "Temperature in Celsius = " << CelsiustoFahrenheit() << endl;
return 0;
}
}
mshefa 0 Newbie Poster
Nick Evan 4,005 Industrious Poster Team Colleague Featured Poster
cikara21 37 Posting Whiz
MosaicFuneral 812 Nearly a Posting Virtuoso
mshefa 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.