README.md

December 4, 2022 ยท View on GitHub

Simple Temperature Converter

Description

Coverts Celsius temperatures to Fahrenheit and visa versa.

More Info

Submitted On
ByJose Verdel
LevelBeginner
User Rating5.0 (10 globes from 2 users)
CompatibilityC++ (general), Borland C++
CategoryMiscellaneous
WorldC / C++
Archive File

Source Code

//////////////////////////////////////////////////
Simple Temperature Converter (c) Jose Verdel 2001
//////////////////////////////////////////////////
#include <iostream.h>
int main()
{
	char temp_t;
 float temp;
 cout << "Enter temperature to be converted:";
 cin >> temp;
 cout >> "Enter f if temperature is Fahrenheit or c for Celsius:";
 cin >> temp_t;
 if (temp_t == 'f')
 {
cout <<"\nThe Celsius temperature is:" << (5.0 / 9.0) * (temp -32.0) << endl;
 }
 else
 {
cout <<"\nThe fahrenheit temperature is:"   << (9.0 / 5.0) *( temp + 32.0) <<endl;
 }
 return 0;
}