summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoolyBoi <[email protected]>2022-11-11 01:26:57 -0800
committerDoolyBoi <[email protected]>2022-11-11 01:26:57 -0800
commitfcbf951c2117a4f52bd626ad9b6ea22ea0b0f9bf (patch)
treee7af8b52c49d9da8ae0fb2f13e2cec28c4d9d553
parentremoved a space (diff)
downloadcst116-lab2-abd00l4h-fcbf951c2117a4f52bd626ad9b6ea22ea0b0f9bf.tar.xz
cst116-lab2-abd00l4h-fcbf951c2117a4f52bd626ad9b6ea22ea0b0f9bf.zip
fixed problem with code not working with online compiliers
-rw-r--r--BlankConsoleLab/CST116-Lab2-Havaldar.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/BlankConsoleLab/CST116-Lab2-Havaldar.cpp b/BlankConsoleLab/CST116-Lab2-Havaldar.cpp
index 8b62d65..3919ba0 100644
--- a/BlankConsoleLab/CST116-Lab2-Havaldar.cpp
+++ b/BlankConsoleLab/CST116-Lab2-Havaldar.cpp
@@ -1,4 +1,5 @@
#include <iostream>
+#include <math.h>
using namespace std;
@@ -38,7 +39,7 @@ Purpose: Ask user for the value of type between min and max
*/
void getUserInputs(float& value, float min, float max, string type)
{
- while (value <= min || value >= max)
+ while (value <= min - 1 || value >= max + 1)
{
cout << "What is the value of " << type << "?" << endl;
cout << "(Enter a value between " << min << " & " << max << ")" << endl;
@@ -65,18 +66,17 @@ Purpose: Ask user what degree they will enter temp in and run functions based of
*/
int main()
{
- string CorF;
- float temp;
- float wSpeed;
- float windChill;
+ char CorF = '0';
+ float temp = 999999;
+ float wSpeed = 999999;
+ float windChill = 0;
- while (CorF != "C" && CorF != "F")
+ while (CorF != 'C' && CorF != 'F')
{
cout << "Do you want to enter in Fahrenheit (F) or Celsius (C)" << endl;
cin >> CorF;
}
-
- if (CorF == "F")
+ if (CorF == 'F')
{
getUserInputs(temp, Fm, FM, "Fahrenheit");
}