diff options
| author | Connor McDowell <[email protected]> | 2024-01-27 16:56:14 -0800 |
|---|---|---|
| committer | Connor McDowell <[email protected]> | 2024-01-27 16:56:14 -0800 |
| commit | 4a95fc5c9dacf4cf55e9e085b666fef6ea97303b (patch) | |
| tree | 37fbddd2488df0479747178fdc023f3f9f7e5112 | |
| parent | test (remove function) (diff) | |
| download | homework-2-connormcdowell275-4a95fc5c9dacf4cf55e9e085b666fef6ea97303b.tar.xz homework-2-connormcdowell275-4a95fc5c9dacf4cf55e9e085b666fef6ea97303b.zip | |
ifdef verbose added to F selection
| -rw-r--r-- | homework2/homework2.cpp | 60 |
1 files changed, 17 insertions, 43 deletions
diff --git a/homework2/homework2.cpp b/homework2/homework2.cpp index d45a4e6..7486f10 100644 --- a/homework2/homework2.cpp +++ b/homework2/homework2.cpp @@ -2,7 +2,7 @@ // Date: 1/20/24 // project reason: Homework 2 #include <iostream> - +#define VERBOSE using std::cout; using std::cin; using std::endl; @@ -29,6 +29,7 @@ int main() float FtoC(float fah); } + // DONE if ( i == 'F') { float cel = 0.0; @@ -37,40 +38,47 @@ int main() cin >> cel; - //float CtoF(int cel); float num = (cel * (9.0 / 5.0)) + 32; if (0 < num && num < 32) { - std::cout << "The temperature: " << num << " fahrenheit, is cold enough that water freezes! brrr!"; + std::cout << "The temperature: " << num << " fahrenheit, is cold enough that water freezes! brrr!" << std::endl; } if (33 < num && num < 65) { - std::cout << "The temperature: " << num << " fahrenheit, is quite chilly! bring a sweater"; + std::cout << "The temperature: " << num << " fahrenheit, is quite chilly! bring a sweater" << std::endl; } if (66 < num && num < 76) { - std::cout << "The temperature: " << num << " fahrenheit, is around room temperature and quite comfortable"; + std::cout << "The temperature: " << num << " fahrenheit, is around room temperature and quite comfortable" << std::endl; } 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."; + std::cout << "The temperature: " << num << " fahrenheit, is pretty warm! drink plenty of water and stay in the shade when you can." << std::endl; } if (89 < num && num < 100) { - std::cout << "The temperature: " << num << " fahrenheit, is very hot, wear sunscreen and hydrate often if going out."; + std::cout << "The temperature: " << num << " fahrenheit, is very hot, wear sunscreen and hydrate often if going out." << std::endl; } if (num > 101) { - std::cout << "The temperature: " << num << " fahrenheit, do not even think about leaving the house."; + std::cout << "The temperature: " << num << " fahrenheit, do not even think about leaving the house." << std::endl; + } + #ifdef VERBOSE + { + std::cout << cel << " C to F" << std::endl; + std::cout << "F = 32 + (9/5 * " << cel << " C)" << std::endl; + std::cout << "F = " << num << " " << std::endl; } + #endif VERBOSE } - + system("pause"); + return 0; } float FtoC(float fah) @@ -82,41 +90,7 @@ float FtoC(float fah) return num; } -float CtoF(float cel) -{ - // 9/5+32 - float num = (cel * (9.0 / 5.0)) + 32; - if (0 < num && num < 32) - { - std::cout << "The temperature: " << num << " fahrenheit, is cold enough that water freezes! brrr!"; - } - if (33 < num && num < 65) - { - std::cout << "The temperature: " << num << " fahrenheit, is quite chilly! bring a sweater"; - } - - if (66 < num && num < 76) - { - std::cout << "The temperature: " << num << " fahrenheit, is around room temperature and quite comfortable"; - } - 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 && num < 100) - { - std::cout << "The temperature: " << num << " fahrenheit, is very hot, wear sunscreen and hydrate often if going out."; - } - - if (num > 101) - { - std::cout << "The temperature: " << num << " fahrenheit, do not even think about leaving the house."; - } - - return num; -}
\ No newline at end of file |