Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Created by Tan
- // Program designed to convert Fahrenheit to Kelvin, and allow additional incremental conversions.
- // Formula used: Kelvin = (Fahrenheit - 32) * 5 / 9 + 273.15
- // Derived from these equations, where the variables are their corresponding numbers degrees, Fahrenheit is °F, etc:
- // (Fahrenheit - 32) * 5 / 9 = Celsius , Kelvin = Celsius - 273.15
- #include "stdafx.h" // Precompiled Header
- #include <iostream> // Needed for Cin Cout
- using namespace std;
- int main()
- {
- double Kelvin, Fahrenheit, Modifier; // Names of variables in our equations.
- cout << "+++++++++++++++++++++++++++++++++++++++" << endl;
- cout << "Fahrenheit to Kelvin Converter by Tan" << endl;
- cout << "Input the Fahrenheit temperature you'd like converted to Kelvin." << endl;
- cout << "Formula this program uses: Kelvin = (Fahrenheit - 32) * 5 / 9 + 273.15 " << endl;
- cout << "+++++++++++++++++++++++++++++++++++++++" << endl;
- cout << "Choose the initial Fahrenheit temperature to convert, then add amounts modifying this number." << endl;
- cin >> Fahrenheit; // Fahrenheit is stored as a number
- Modifier = 0; // Modifier is initially zero.
- do
- {
- Kelvin = (Fahrenheit - 32) * 5 / 9 + 273.15;
- cout << Fahrenheit << " degrees Fahrenheit is equivalent to " << Kelvin << " degrees Kelvin." << endl;
- cin >> Modifier; // Modifier for Fahrenheit
- Fahrenheit = Fahrenheit + Modifier; // The incremental is added to the current value of Fahrenheit and a new equation giving a value of Kelvin is output.
- } while (Fahrenheit <= 200); // End the reading of incremental responses if the combined amount of Fahrenheit is ever equal to or greater than 200.
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement