diff options
| author | Nataliia Brown <[email protected]> | 2024-01-27 21:47:12 -0800 |
|---|---|---|
| committer | Nataliia Brown <[email protected]> | 2024-01-27 21:47:12 -0800 |
| commit | 27335f57e7ff9acead9b33b227b144caa6820b78 (patch) | |
| tree | 757b7de0053ae8930b7699f77f289b249cbe139a /Homework_2 | |
| parent | Initial commit (diff) | |
| download | homework-2-natabrown-27335f57e7ff9acead9b33b227b144caa6820b78.tar.xz homework-2-natabrown-27335f57e7ff9acead9b33b227b144caa6820b78.zip | |
Added options, conversion, statements.
Diffstat (limited to 'Homework_2')
| -rw-r--r-- | Homework_2/Homework_2/HW_2.cpp | 73 |
1 files changed, 72 insertions, 1 deletions
diff --git a/Homework_2/Homework_2/HW_2.cpp b/Homework_2/Homework_2/HW_2.cpp index ad12743..6a24e4e 100644 --- a/Homework_2/Homework_2/HW_2.cpp +++ b/Homework_2/Homework_2/HW_2.cpp @@ -3,11 +3,82 @@ // Class: CST 116 // Assignment: Homework 2 + +#include <iostream> + + +using std::cout; +using std::cin; +using std::endl; + int main() { + int i, y, b; + + cout << "Please enter 0 to convert from Celsius to Fahrenheit or 1 to convert from Fahrenheit to Celsius" << endl; + + cin >> i; + + + + switch (i) + { + case 0: + cout << "Here is how to convert from Celsius to Fahrenheit: Temperature in C * 9/5 + 32" << endl; + + int x; + + cout << "Please enter the temperature in Celsius to convert to Fahrenheit" << endl; + + cin >> x; + + y = (x * (9.0 / 5.00)) + 32; + + cout << "Your temperature is " << y << " in Fahrenheit" << endl; + + if (y < 40) + { + cout << "It's freezing cold!\n"; + } + else if (i > 85) + { + cout << "Looks like it's super warm today!\n"; + } + else + { + cout << "Not too hot, not too cold. Just perfect!\n"; + } + + break; + + case 1: + cout << "Here is how to convert from Fahrenheit to Celsius: Temperature in F - 32 * 5/9" << endl; + + int a; + + cout << "Please enter the temperature in Fahrenheit to convert to Celsius" << endl; + + cin >> a; + + b = ((a - 32) * (5.0 / 9.0)); + cout << "Your temperature is " << b << " in Celsius" << endl; + if (a < 40) + { + cout << "It's freezing cold!\n"; + } + else if (a > 85) + { + cout << "Looks like it's super warm today!\n"; + } + else + { + cout << "Not too hot, not too cold. Just perfect!\n"; + } + break; + } return 0; -}
\ No newline at end of file +} |