README.md
December 4, 2022 ยท View on GitHub
Description
Coverts Celsius temperatures to Fahrenheit and visa versa.
More Info
| Submitted On | |
| By | Jose Verdel |
| Level | Beginner |
| User Rating | 5.0 (10 globes from 2 users) |
| Compatibility | C++ (general), Borland C++ |
| Category | Miscellaneous |
| World | C / 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;
}