G
Ginsued
Guest
With the help of The End I was able to write this as my first C++ program.
It converts both Fahrenheit to Celsius and Celsius to Fahrenheit.
I found it useful so i though I'd post it.
First the .exe: http://files.filefront.com/Conversionexe/;7957265;;/fileinfo.html
Now the code.
It converts both Fahrenheit to Celsius and Celsius to Fahrenheit.
I found it useful so i though I'd post it.
First the .exe: http://files.filefront.com/Conversionexe/;7957265;;/fileinfo.html
Now the code.
Code:
#include <iostream>
using namespace std;
int main(void)
{
double fahrenheit,celsius,choice;
start:
cout << "Please choose what you want to do. " << endl;
cout << "1) Fahrenheit to Celsius. " << endl;
cout << "2) Celsius to Fahrenheit. " << endl << endl;
cin >> choice;
if (choice == 1)
{
cout << "Enter degree in Fahrenheit: ";
cin >> fahrenheit;
//convert
celsius = (5.0 / 9.0) * (fahrenheit - 32.0);
cout << "The degrees in Celsius is: " << celsius << endl;
system("pause");
return 0;
}
if (choice == 2)
{
cout << "Enter degree in Celsius: ";
cin >> celsius;
//convert
fahrenheit = ((celsius * 9.0) / 5) + 32;
cout << "The degrees in Fahrenheit is: " << fahrenheit << endl;
system("pause");
}
else {
cout << "Invalid option, please try again." << endl;
goto start;
}
return 0;
}

