0% found this document useful (0 votes)
40 views2 pages

Program 1.2

The document describes a C++ program that allows users to convert between Fahrenheit and Celsius temperatures. The program displays a menu, takes the user's choice of conversion, inputs the starting temperature, performs the conversion calculation, and displays the result.

Uploaded by

Aadil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views2 pages

Program 1.2

The document describes a C++ program that allows users to convert between Fahrenheit and Celsius temperatures. The program displays a menu, takes the user's choice of conversion, inputs the starting temperature, performs the conversion calculation, and displays the result.

Uploaded by

Aadil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Program 1.

2
Write a temperature-conversion program that gives the user the option of converting Fahrenheit to celcius
or celsius to Fahrenheit and depending upon user’s choice carries out the conversion.

#include<iostream.h>

int main()

int choice;

double temp,conv_temp;

cout<<”temperature conversion menu”<<”\n”;

cout<<”1.fahrenheit to calsius ”<<”\n”;

cout<<”2.celsius to fahrenheit”<<”\n”;

cout<<”enter your choice(1-2):”;

cin>>choice;

if (choice==1)

cout<<”\n”<<”enter temperature in Fahrenheit:”;

cin>>temp;

conv_temp =(temp-32)/1.8;

cout<<”the temperature in Celsius is ”<<”conv_temp”<<”\n”;

else

cout<<”\n”<<”enter temperature in Celsius:”;

cin>>temp;

conv_temp=(1.8*temp)+32;

cout<<”the temperature in Fahrenheit is”<<”conv_temp”<<”\n”;

}
return 0;

Output:

Temperature conversion menu


1. fahrenheit to Celsius

2. Celsius to Fahrenheit

Enter your choice(1-2) : 1

Enter temperature in farenheit :98.4

The temperature in calsius is 36.888889

You might also like