Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int choice;
- float input, conversion;
- //here is used to select the conversions.
- cout << "Temperature Conversions Select a number to Proceed:" << endl;
- cout << "1. Degree Farhenheit to Degree Celcius" << endl;
- cout << "2. Degree Celcius to Degree Fahrenheit" << endl;
- cout << "Enter your choice: ";
- cin >> choice;
- //if choice 1 is selected then only the first line of code will be executed
- if (choice == 1)
- {
- cout << "Enter the Degree Fahrenheit Value: ";
- cin >> input;
- conversion = (input-32) / 1.8;
- cout << "The temperature in degree celcius is: " << conversion << " °C";
- }
- // if choice 2 is selected, the else statement will run, insread of the if statement.
- else
- {
- cout << "Enter the Degree Celcius Value: ";
- cin >> input;
- conversion = (1.8 * input) + 32;
- cout << "The temperature in degree fahrenheit is: " << conversion << " °F";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement