A
arnuld
i have created a new temperature conversion programme. it converts a
temperature from Fahrenheit to Celsius or from Celsius to Fahrenheit
at user's will. tell em if i need some improvements:
// conversion of temperature
// using Centigrade and Fahrenheit
#include <iostream>
int main() {
double centi;
double fahr;
char ans;
std::cout << "do you want to convert a Centigrade into Fahrenheit:
[y/n]";
std::cin >> ans;
if(ans == 'y')
{
std::cout << "Enter temperature in Centigrade: ";
std::cin >> centi;
fahr = (9.0/5.0 * centi) + 32;
std::cout << centi
<< " centigrade = "
<< fahr
<< " fahrenheit"
<< "\n";
}
else
{
std::cout << "Enter temperature in Fahrenheit: ";
std::cin >> fahr;
centi = 5.0/9.0 * (fahr - 32);
std::cout << fahr
<< " farenheit = "
<< centi
<< " centigrade"
<< "\n";
}
return 0;
}
-- arnuld
http://arnuld.blogspot.com
temperature from Fahrenheit to Celsius or from Celsius to Fahrenheit
at user's will. tell em if i need some improvements:
// conversion of temperature
// using Centigrade and Fahrenheit
#include <iostream>
int main() {
double centi;
double fahr;
char ans;
std::cout << "do you want to convert a Centigrade into Fahrenheit:
[y/n]";
std::cin >> ans;
if(ans == 'y')
{
std::cout << "Enter temperature in Centigrade: ";
std::cin >> centi;
fahr = (9.0/5.0 * centi) + 32;
std::cout << centi
<< " centigrade = "
<< fahr
<< " fahrenheit"
<< "\n";
}
else
{
std::cout << "Enter temperature in Fahrenheit: ";
std::cin >> fahr;
centi = 5.0/9.0 * (fahr - 32);
std::cout << fahr
<< " farenheit = "
<< centi
<< " centigrade"
<< "\n";
}
return 0;
}
-- arnuld
http://arnuld.blogspot.com