aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConnor McDowell <[email protected]>2024-01-27 16:25:05 -0800
committerConnor McDowell <[email protected]>2024-01-27 16:25:05 -0800
commit216203017609785573d54867974ee9b2c51e1888 (patch)
treed406ce79cb44e2d6c818e4ff9113bc799ab3ddb9
parentCel to fah if outs created (diff)
downloadhomework-2-connormcdowell275-216203017609785573d54867974ee9b2c51e1888.tar.xz
homework-2-connormcdowell275-216203017609785573d54867974ee9b2c51e1888.zip
fixed unsafe use of bool type
-rw-r--r--homework2/homework2.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/homework2/homework2.cpp b/homework2/homework2.cpp
index 7504751..5c038a7 100644
--- a/homework2/homework2.cpp
+++ b/homework2/homework2.cpp
@@ -39,7 +39,7 @@ int main()
float CtoF(int cel);
}
-
+
}
float FtoC(float fah)
@@ -57,27 +57,27 @@ float CtoF(float cel)
float num = (cel * (9.0 / 5.0)) + 32;
- if (0 < num < 32)
+ if (0 < num && num < 32)
{
std::cout << "The temperature: " << num << " fahrenheit, is cold enough that water freezes! brrr!";
}
- if (33 < num < 65)
+ if (33 < num && num < 65)
{
std::cout << "The temperature: " << num << " fahrenheit, is quite chilly! bring a sweater";
}
- if (66 < num < 76)
+ if (66 < num && num < 76)
{
std::cout << "The temperature: " << num << " fahrenheit, is around room temperature and quite comfortable";
}
- if (78 < num < 88)
+ if (78 < num && num < 88)
{
std::cout << "The temperature: " << num << " fahrenheit, is pretty warm! drink plenty of water and stay in the shade when you can.";
}
- if (89 < num < 100)
+ if (89 < num && num < 100)
{
std::cout << "The temperature: " << num << " fahrenheit, is very hot, wear sunscreen and hydrate often if going out.";
}