summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoolyBoi <[email protected]>2022-11-09 20:41:35 -0800
committerDoolyBoi <[email protected]>2022-11-09 20:41:35 -0800
commit34e697b9f0026038cb7ef278086fa304051db9fd (patch)
tree02996ffac9bbab0657ef0a0d8ff583dc7b091400
parentSetting up GitHub Classroom Feedback (diff)
downloadcst116-lab2-abd00l4h-34e697b9f0026038cb7ef278086fa304051db9fd.tar.xz
cst116-lab2-abd00l4h-34e697b9f0026038cb7ef278086fa304051db9fd.zip
added 3 functions
-rw-r--r--BlankConsoleLab/BlankConsoleLab.cpp61
-rw-r--r--BlankConsoleLab/BlankConsoleLab.vcxproj8
2 files changed, 61 insertions, 8 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp
index ed5f807..82c5124 100644
--- a/BlankConsoleLab/BlankConsoleLab.cpp
+++ b/BlankConsoleLab/BlankConsoleLab.cpp
@@ -5,12 +5,65 @@
using namespace std;
-using std::cout;
-using std::cin;
-using std::endl;
+float C_to_F(float x);
+void getUserInputs(float& value, float min, float max, string type);
+float calculate(float mph, float degrees);
+
+//m is min; M is max
+const float Fm = -80;
+const float FM = 121;
+const float Cm = -62;
+const float CM = 49.5;
+const float Wm = 0;
+const float WM = 231;
+
+float C_to_F(float x)
+{
+ x *= 1.8;
+ x += 32;
+ return x;
+}
+
+void getUserInputs(float& value, float min, float max, string type)
+{
+ while (value <= min || value >= max)
+ {
+ cout << "What is the value of " << type << "?" << endl;
+ cout << "(Enter a value between " << Fm << " & " << FM << ")" << endl;
+ cin >> value;
+ }
+}
+
+float calculate(float mph, float degrees)
+{
+ return (35.74 + (0.6215 * degrees) - (35.75 * pow(mph, 0.16)) + (0.4275 * degrees * pow(mph, 0.16)));
+}
int main()
{
- cout << "Hello World!\n";
+ string CorF;
+ float temp;
+ float wSpeed;
+
+ while (CorF != "C" && CorF != "F")
+ {
+ cout << "Do you want to enter in Fahrenheit (F) or Celsius (C)" << endl;
+ cin >> CorF;
+ }
+
+ if (CorF == "F")
+ {
+ getUserInputs(temp, Fm, FM, "Fahrenheit");
+ }
+ else
+ {
+ getUserInputs(temp, Cm, CM, "Celcius");
+ temp = C_to_F(temp);
+ cout << "That is " << temp << " degrees in Fahrenheit" << endl;
+ }
+
+ getUserInputs(wSpeed, Wm, WM, "Wind Speed");
+
+
}
diff --git a/BlankConsoleLab/BlankConsoleLab.vcxproj b/BlankConsoleLab/BlankConsoleLab.vcxproj
index db2e734..d2e3ee2 100644
--- a/BlankConsoleLab/BlankConsoleLab.vcxproj
+++ b/BlankConsoleLab/BlankConsoleLab.vcxproj
@@ -29,26 +29,26 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v142</PlatformToolset>
+ <PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v142</PlatformToolset>
+ <PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v142</PlatformToolset>
+ <PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v142</PlatformToolset>
+ <PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>