aboutsummaryrefslogtreecommitdiff
path: root/Homework2ReeceWarner
diff options
context:
space:
mode:
authorrPatrickWarner <[email protected]>2024-01-20 11:28:24 -0800
committerrPatrickWarner <[email protected]>2024-01-20 11:28:24 -0800
commitd3840a579796e1d61ab695580449cb44495a9322 (patch)
tree7b93574786b9ba8e353bb60066cf5389c408e514 /Homework2ReeceWarner
parentinit (diff)
downloadhomework-2-reecepwarner-main.tar.xz
homework-2-reecepwarner-main.zip
completedHEADmain
Diffstat (limited to 'Homework2ReeceWarner')
-rw-r--r--Homework2ReeceWarner/Homework2ReeceWarner/Source.cpp74
1 files changed, 68 insertions, 6 deletions
diff --git a/Homework2ReeceWarner/Homework2ReeceWarner/Source.cpp b/Homework2ReeceWarner/Homework2ReeceWarner/Source.cpp
index 39d17a2..c9681c5 100644
--- a/Homework2ReeceWarner/Homework2ReeceWarner/Source.cpp
+++ b/Homework2ReeceWarner/Homework2ReeceWarner/Source.cpp
@@ -4,22 +4,84 @@
//Homework2
#include <iostream>
+#define VERBOSE
+#ifdef VERBOSE
+#endif
+
using std::cin;
using std::cout;
using std::endl;
-
-
+int userinput=0;
+const int tt = 32;
+const double ctf = 9.0/5;
+const double ftc = 5.0 / 9;
int main()
{
+ cout << "Would you like to convert Farenheit or Celsius?" << endl
+ << "Type \"1\" for Farenheit, type \"2\" for Celsius" << endl;
+ cin >> userinput;
+ int Ftemp;
+ int Ctemp;
+ switch (userinput)
+ {
+ case (1):
+ {
+ cout << "What temperature would you like to convert?\n";
+ cin >> Ftemp;
+ cout << "Your converted temperature is:\n" << ftc * (Ftemp - 32) << endl;
+
+ int ftctemp = ftc * (Ftemp - 32);
+ if (ftctemp < 0)
+ {
+ cout << "That is below the freezing temperature of water!\nI hope you agree, Celsius is a better representation of the temperature!" << endl;
+ }
+ if (ftctemp == 0)
+ {
+ cout << "If you were a drop of water, you'd be frozen. Celsius seems a lot colder than our American temperature measurements" << endl;
+ }
+ if (ftctemp >= 100)
+ {
+ cout << "I hope you're a noodle and not a human because you're boiling!!!" << endl;
+ }
+#ifdef VERBOSE
+ {
+ cout << "Your conversion process\n" << endl;
+ cout << ftc << "(" << Ftemp << "F" << "-" << tt << ") = " << ftctemp << "C" << endl;
+ }
+#endif
+ break;
+ }
+ case (2):{
+ cout << "What temperature in Celsius would you like to convert?\n";
+ cin >> Ctemp;
+ cout << "Your converted temperature is:\n" << (ctf * Ctemp) + 32 << endl;
+ int ctftemp = (ctf * Ctemp) + 32;
+ if (ctftemp < 32) {
+ cout << "I bet these cold temperatures look confusing coming from Celsius:( Maybe grab a coat!" << endl;
+ }
+ if (ctftemp == 32) {
+ cout << "You are now at the freezing temperature of water! Try not to get any frost on your computer:)" << endl;
+ }
+ if (ctftemp >= 212) {
+ cout << "Please tell me you're not boiling yourself... I hope you're okay!" << endl;
+ }
+#ifdef VERBOSE
+ {
+ cout << "Your conversion process\n" << endl;
+ cout << "(" << ctf << "*" << Ctemp << "C" << ") + " << tt << " = " << ctftemp << "F" << endl;
+ }
+#endif
+ break;
+ }
+ default:
+ cout << "invalid input, I am not quite sure what you want from me:((" << endl;
+ }
-
-
-
- return 0;
+ return 0;
} \ No newline at end of file