From 27335f57e7ff9acead9b33b227b144caa6820b78 Mon Sep 17 00:00:00 2001 From: Nataliia Brown Date: Sat, 27 Jan 2024 21:47:12 -0800 Subject: Added options, conversion, statements. --- Homework_2/Homework_2/HW_2.cpp | 73 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 72 insertions(+), 1 deletion(-) (limited to 'Homework_2') 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 + + +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 +} -- cgit v1.2.3