diff options
Diffstat (limited to 'BlankConsoleLab/CST116-Lab2-Havaldar.cpp')
| -rw-r--r-- | BlankConsoleLab/CST116-Lab2-Havaldar.cpp | 16 |
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"); } |